{"id":38802,"date":"2018-06-14T03:01:55","date_gmt":"2018-06-13T17:01:55","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=38802"},"modified":"2018-06-14T07:30:01","modified_gmt":"2018-06-13T21:30:01","slug":"android-studio-project-copy-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-project-copy-tutorial\/","title":{"rendered":"Android Studio Project Copy Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/lpvia.jpg\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Android Studio on Project Copy Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Android\/lpvia.jpg\" title=\"Android Studio Project Copy Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Android Studio Project Copy Tutorial<\/p><\/div>\n<p>The concept of &#8220;Project Copy&#8221; in terms of discussing the Android Studio IDE creator of Android mobile applications is an interesting one.  For us at least, what most comes to mind is that you &#8230;<\/p>\n<ul>\n<li>physically copy the Android Studio project, and we are using Mac OS X&#8217;s Finder today, though Windows users could use Windows Explorer<\/li>\n<li>open Android Studio to this new project for &#8230;\n<ol>\n<li>Refactor -&gt; Rename Package Name<\/li>\n<li>Refactor -&gt; Rename Directories<\/li>\n<\/ol>\n<p> &#8230; combinations of project directory with two finger gesture (Mac OS X) versus right click (Windows) options<\/p>\n<li>Go through the code and xml configurations changing old package name to new package name (visit everything!)<\/li>\n<li>as you are going, change inappropriate project name wording<\/li>\n<\/ul>\n<p> &#8230; and in order to do this we must recommend the advice at this <a target=_blank title='Great link, thanks' href='https:\/\/stackoverflow.com\/questions\/18324555\/android-copy-existing-project-with-new-name-in-android-studio'>great link<\/a>, thanks &#8230; specifically &#8230;<\/p>\n<blockquote cite='https:\/\/stackoverflow.com\/questions\/18324555\/android-copy-existing-project-with-new-name-in-android-studio'><p>\nI&#8217;m following these steps and it&#8217;s been working so far:<br \/>\n<b><\/b><br \/>\nCopy and paste the folder as used to.<br \/>\nOpen Android Studio (v3.0.1).<br \/>\nSelect Open an existing Project.<br \/>\nClose the message that will pop up with title: &#8220;Import Gradle Projects&#8221;.<br \/>\nAt left side on Android Tab go to: app -> java -> select the first folder (your project folder)<br \/>\nRefactor => Rename&#8230; (Shift + F6)<br \/>\nRename Package, Select both options &#8211; Put the new folder&#8217;s name in lowercase.<br \/>\nDo Refactor<br \/>\nSelect: Sync Project with Gradle Files at toolbar.<br \/>\nBuild => Clean Project<br \/>\nGo to app -> res -> values -> strings.xml, and change the app name at 2nd line.\n<\/p><\/blockquote>\n<p> &#8230; though when I did this as a first pass, left out some references I had to the changing of &#8230;<\/p>\n<ul>\n<li>old package name &#8220;au.com.rjmprogramming.eslideas&#8221; &#8230; to &#8230;<\/li>\n<li>new package name &#8220;com.rjmprogramming.learning_programming&#8221;<\/li>\n<\/ul>\n<p> &#8230; though suspect some of the extra issues I had were related to that extra hierarchy of package name component &#8220;au&#8221; becoming obsolete.  We found that nothing needed deleting with this method, though am not ruling this out in the &#8220;Build&#8221; part of the project, for you, nor that you will not need to do a Gradle Sync at some stage in the process.<\/p>\n<p>We hope this is of some interest to you, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/lpvia.jpg\" title=\"Click picture\">what we were doing with this<\/a>, and you can read more in this Android Studio topic with <a title='Android Studio Real Physical Device Tutorial' href='#asrpdt'>Android Studio Real Physical Device Tutorial<\/a> below.<\/p>\n<hr>\n<p id='asrpdt'>Previous relevant <a target=_blank title='Android Studio Real Physical Device Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-real-physical-device-tutorial\/'>Android Studio Real Physical Device Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/android_studio_rpd-10of.jpg\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Android Studio Real Physical Device Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/android_studio_rpd-10of.jpg\" title=\"Android Studio Real Physical Device Tutorial\" id='qgiow10' onmouseover=\" this.src=this.src.replace('-10of.j','-1of.xj').replace('-1of.j','-2of.xj').replace('-2of.j','-3of.xj').replace('-3of.j','-4of.xj').replace('-4of.j','-5of.xj').replace('-5of.j','-6of.xj').replace('-6of.j','-7of.xj').replace('-7of.j','-8of.xj').replace('-8of.j','-9of.xj').replace('-9of.j','-10of.xj').replace('.xj','.j');   \"  \/><\/a><p class=\"wp-caption-text\">Android Studio Real Physical Device Tutorial<\/p><\/div>\n<p>When creating Android apps with Android Studio IDE (or any other <a target=_blank title='IDE information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a>, for that matter) it&#8217;s great to test the working of the app with various mobile phone and tablet emulators with <a target=_blank title='AVD information from Android Studio IDE' href='http:\/\/developer.android.com\/tools\/help\/avd-manager.html'>AVD<\/a>, and it&#8217;s even &#8220;greater&#8221; to extend that to testing on a real physical device.<\/p>\n<p>Today, we&#8217;re going to work with &#8230;<\/p>\n<ul>\n<li>MacBook Pro testing that latest Android app using an Android Studio IDE project which we talked about with <a target=_blank title='Android Studio on Mac OS X Primer Tutorial' href='#asimixpt'>Android Studio on Mac OS X Primer Tutorial<\/a> regarding &#8220;ESL Ideas&#8221;<\/li>\n<li>another (ubiquitous) white lead &#8230; called a Micro USB Connector &#8230; <font size=1>but not Muc, pleeeeease<\/font> &#8230; decided against the puce one because it just didn&#8217;t go with the cushions &#8230; <font size=1>but we digress<\/font><\/li>\n<li>Samsung GT-S5310B Android 4.1.2 mobile phone &#8230; and, today <font size=1>of all days<\/font> the &#8220;4.1.2&#8221; is a bit signific<font size=6>ant<\/font> &#8230; because we want to talk about <a target=_blank title='ant builds' href='http:\/\/stackoverflow.com\/questions\/16618395\/doing-an-ant-build-on-android-studio'>ant builds<\/a> &#8230; <font size=1>but we digress<\/font><\/li>\n<\/ul>\n<p>The (ubiquitous) white lead goes from the MacBook Pro&#8217;s USB port to the &#8220;underbelly&#8221; of the Samsung GT-S5310B.<\/p>\n<p>One thing to do at the &#8220;computer&#8221; Android Studio end of the lead is to adjust <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/AndroidManifest.xml-GETME\" title='AndroidManifest.xml'>AndroidManifest.xml<\/a> to show <code>android:debuggable=\"true\"<\/code> now.<\/p>\n<p>Now if you&#8217;re on Windows I&#8217;d have more to say about the &#8220;computer&#8221; end of the lead, and if that is you, and you&#8217;ve never tested on a real device, you&#8217;ll want to read this great <a target=_blank title='Useful page' href='http:\/\/developer.android.com\/tools\/device.html'>Google Android Studio page<\/a>.<\/p>\n<p>Come to think of it, everybody who&#8217;s never tested on a real device should read <a target=_blank title='Useful page' href='http:\/\/developer.android.com\/tools\/device.html'>Google Android Studio page<\/a>.  See the advice about Android 4.2 &#8230; note that &#8230; ie. if the Settings menu&#8217;s submenu Developer Options is all grayed out tap on Build number (via Settings-&gt;About device) seven times &#8230; and <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=YsSaSyg7mjM'>&#8220;twice on the pipe, if the answer is noooooooooo&#8221;<\/a> &#8230; <font size=1>but we digress<\/font>.<\/p>\n<p>However, we have a mobile phone with Android 4.1.2 &#8230; and so &#8230; this <a target=_blank title='Useful search' href='https:\/\/www.google.com.au\/search?q=samsung+developer+options+grayed+out&#038;ie=utf-8&#038;oe=utf-8&#038;gws_rd=cr&#038;ei=KLrDVsa6JMmc0gSM2qWQBA#q=samsung+developer+options+grayed+out+android+4.1.2'>search<\/a> got me to this <a target=_blank title='Great advice' href='http:\/\/www.xoomforums.com\/forum\/motorola-xoom-help\/20253-cannot-enable-usb-debugging.html'>great advice<\/a> &#8230; and the consequent turning on of the Settings-&gt;Developer Options &#8220;switch&#8221; to on meant &#8230; Bob&#8217;s your uncle, Fanny&#8217;s your aunt &#8230; Android Studio responded like a &#8230; like a &#8230; well &#8230; a very hot studio.<\/p>\n<p>A &#8220;Run App&#8221; will default to hooking up to this connected physical device (the Samsung GT-S5310B) and run the resultant mobile app on that device.<\/p>\n<hr>\n<p id='asimixpt'>Previous relevant <a target=_blank title='Android Studio on Mac OS X Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-on-mac-os-x-primer-tutorial\/'>Android Studio on Mac OS X Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Android Studio on Mac OS X Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/android_studio_macosx-176of.jpg\" title=\"Android Studio on Mac OS X Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Android Studio on Mac OS X Primer Tutorial<\/p><\/div>\n<p>There are a lot of choices of <a target=_blank title='Integrated Development Environment information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> for creating mobile applications, and if you are a developer wanting to develop mobile apps for both <a target=_blank title='Android information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Android_(operating_system)'>Android<\/a> and <a target=_blank title='iOS information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/IOS'>iOS<\/a> platforms, you may be looking to try to set up an environment where all this can be achieved on the one piece of computer equipment.<\/p>\n<p>We prefer to think in terms of two IDEs handling the two mobile app types of iOS, with Swift and\/or Objective-C as the source language, and Android, with Java as the source language.  We don&#8217;t mind there being two separate IDEs involved, but we find it amazing enough that they can both sit on the one MacBook Pro laptop without resorting to any Operating System <a target=_blank title='Disk partition information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Disk_partitioning'>disk partitions<\/a>.  With the Android app, using Mac OS X (MacBook Pro) we asked Google if it could be done, and came up with the marvellous <a target=_blank title='Andoid Studio IDE landing page' href='http:\/\/developer.android.com\/'>Android Studio<\/a> IDE as a possibility &#8230; yay!<\/p>\n<ul>\n<li>iOS mobile apps get created via the <a target=_blank title='Xcode information from Apple' href='https:\/\/developer.apple.com\/xcode\/'>Xcode<\/a> IDE using Swift and\/or Objective-C on a Mac OS X (MacBook Pro)<\/li>\n<li>Android apps get created via the Android Studio IDE using Java on a Mac OS X (MacBook Pro)<\/li>\n<\/ul>\n<p>Today&#8217;s tutorial, as with the WordPress 4.1.1&#8217;s <a target=_blank title='Android Studio on Mac OS X Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-on-mac-os-x-primer-tutorial\/'>Android Studio on Mac OS X Primer Tutorial<\/a>, hones in on that second idea from the install of Android Studio (to a MacBook Pro) through to the &#8220;middle game&#8221; emulation of an Android app via Android Studio and <a target=_blank title='AVD information from Android Studio IDE' href='http:\/\/developer.android.com\/tools\/help\/avd-manager.html'>AVD<\/a> onto an HTC Nexus One.<\/p>\n<p>Please don&#8217;t think this is the only approach &#8230; and please research <a target=_blank title='PhoneGap' href='http:\/\/phonegap.com\/'>PhoneGap<\/a> (<a target=_blank title='PhoneGap iOS Mobile Xcode Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2460'>PhoneGap iOS Mobile Xcode Primer Tutorial<\/a>) and <a target=_blank title='jQuery Mobile' href='https:\/\/jquerymobile.com\/'>jQuery Mobile<\/a> (<a target=_blank title='jQuery Mobile Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2444'>jQuery Mobile Primer Tutorial<\/a>) and <a target=_blank title='Embarcadero' href='https:\/\/downloads.embarcadero.com\/free\/delphi'>Embarcadero<\/a> (<a target=_blank title='Delphi Pascal++ Embarcadero XE6 Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/delphi-pascal-embarcadero-xe6-primer-tutorial\/'>Delphi Pascal++ Embarcadero XE6 Primer Tutorial<\/a>) also, perhaps for an approach that uses other ways of looking at the issue.<\/p>\n<p>In the context of all this, we see the Android app &#8220;end game&#8221; as involving the creation of an <a target=_blank title='apk file information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Android_application_package'>.apk<\/a> file that can be uploaded to <a target=_blank title='Google Play' href='https:\/\/play.google.com\/'>Google Play<\/a> for public access.<\/p>\n<p>Similarly to our associated <a target=_blank title='Android Studio Google Play Ready Primer Tutorial' href='#asgprpt'>Android Studio Google Play Ready Primer Tutorial<\/a> as shown below, today, the concepts in the Android Studio project regarding the &#8220;middle game&#8221;, comparing it to the <a target=_blank title='Eclipse IDE downloads page' href='https:\/\/eclipse.org\/downloads\/'>Eclipse<\/a> IDE (<a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2377' title='Eclipse Android App Google Play Ready Primer Tutorial'>Eclipse Android App Google Play Ready Primer Tutorial<\/a>), for which huge help came from this great <a target=_blank title='Embed WebView in Fragment' href='http:\/\/android-er.blogspot.com.au\/2013\/04\/embed-webview-in-fragment.html'>link<\/a> &#8230; thanks &#8230; are, again, for our &#8220;ESL Ideas&#8221; Android mobile app (which &#8220;channels&#8221; our project, recently, started with <a target=_blank title='HTML\/Javascript Themed Supervision Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-themed-supervision-primer-tutorial\/'>HTML\/Javascript Themed Supervision Primer Tutorial<\/a>) of today &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Android fragments' href='http:\/\/www.i-programmer.info\/programming\/android\/6882-introducing-android-fragments.html'>Fragments<\/a> &#8211; components of the Android UI &#8230; and setting of startup fragment of interest &#8230; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/fragment_weblayout.xml_GETME\" title='fragment_weblayout.xml'>fragment_weblayout.xml<\/a> &#8230; fragments go some way to addressing that common issue for mobile developers that all the UI elements of a mobile application fit and would ideally be displayed with a tablet but it would be best to only conditionally display some when it comes to using a smaller format mobile device such as an Android mobile phone device<\/li>\n<li>Main Java in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/MainActivity.java_GETME\" title='MainActivity.java'>MainActivity.java<\/a> &#8230; similar to Eclipse<\/li>\n<li>Layout in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/activity_main.xml_GETME\" title='activity_main.xml'>activity_main.xml<\/a> &#8230; similar to Eclipse<\/li>\n<li>WebView &#8230; similar to Eclipse &#8230; allows an Internet web component in your Android mobile app<\/li>\n<li>Use of <code> myWebView.getSettings().setJavaScriptEnabled(true); <\/code> to allow Javascript functionality for the WebView<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Eslideas\/AndroidManifest.xml_GETME\" title='AndroidManifest.xml'>AndroidManifest.xml<\/a> &#8230; INTERNET permission &#8230; similar to Eclipse &#8230; to <i>Build-&gt;&#8221;Generate Signed APK&#8230;&#8221;<\/i> for Google Play publishing you need the extra &#8230; <code>  android:debuggable=\"false\"  <\/code> clause<\/li>\n<li>Tools-&gt;Android-&gt;AVD Manager &#8230; emulator organization and emulator deployment help &#8230; remains the case that it is best to start the emulator all the way to the home page at the simulated device (right swipe unlocking any locks you get) &#8230; then run and attach your mobile app to this pre-established connection<\/li>\n<\/ul>\n<p>You will be pleased to know that after the Android Studio install today, all is (still) well with Xcode on this Mac OS X (MacBook Pro) setup &#8230; we mostly like a happy ending &#8230; aaaaaaahhhhhhh!<\/p>\n<hr>\n<p id='asgprpt'>Previous relevant <a target=_blank title='Android Studio Google Play Ready Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-google-play-ready-primer-tutorial\/'>Android Studio Google Play Ready Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Android Studio Google Play Ready Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/Morsecodeemail-99qof.jpg\" title=\"Android Studio Google Play Ready Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Android Studio Google Play Ready Primer Tutorial<\/p><\/div>\n<p>Yesterday, with <a target=_blank title='Android Studio Tic Tac Toe Game Tutorial' href='#astttgt'>Android Studio Tic Tac Toe Game Tutorial<\/a> as shown below,  we reacquainted ourselves with <a target=_blank title='Android Studio download' href='http:\/\/developer.android.com\/sdk\/'>Android Studio<\/a> as an alternative <a target=_blank title='ide info from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> to <a target=_blank title='eclipse download' href='https:\/\/eclipse.org\/downloads\/'>Eclipse<\/a> (and there are others too) to use the Android SDK and Java to develop mobile apps for an Android mobile device and in our aforesaid mentioned &#8220;start game&#8221;, &#8220;middle game&#8221; and &#8220;end game&#8221; view of mobile development we focussed on the &#8220;middle game&#8221;.<\/p>\n<p>Today, we extend the &#8220;middle game&#8221; discussion of yesterday, with tutorial functionality touching on the &#8220;end game&#8221; with respect to Android Studio creating an Android mobile app on <a target=_blank title='Google Play' href='https:\/\/play.google.com\/'>Google Play<\/a>.<\/p>\n<p>Wonder if you were around when we created the <a target=_blank title='Morse Code information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Morse_code'>Morse Code<\/a> emailer &#8230;  <a target=_blank title='HTML Morse Code Primer Tutorial' href='?p=11901'>HTML Morse Code Primer Tutorial<\/a>?  Well, today, we turn that into an Android mobile application using Android Studio, and publish it to Google Play for general &#8220;consumption&#8221; by the public.<\/p>\n<p>So what are some of the concepts in the Android Studio project regarding the &#8220;middle game&#8221;, for which huge help came from this great <a target=_blank title='Embed WebView in Fragment' href='http:\/\/android-er.blogspot.com.au\/2013\/04\/embed-webview-in-fragment.html'>link<\/a> &#8230; thanks &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Android fragments' href='http:\/\/www.i-programmer.info\/programming\/android\/6882-introducing-android-fragments.html'>Fragments<\/a> &#8211; components of the Android UI &#8230; and setting of startup fragment of interest &#8230; fragments go some way to addressing that common issue for mobile developers that all the UI elements of a mobile application fit and would ideally be displayed with a tablet but it would be best to only conditionally display some when it comes to using a smaller format mobile device such as an Android mobile phone device<\/li>\n<li>Layout in activity_main.xml &#8230; similar to Eclipse<\/li>\n<li>WebView &#8230; similar to Eclipse &#8230; allows an Internet web component in your Android mobile app<\/li>\n<li>Use of <code> myWebView.getSettings().setJavaScriptEnabled(true); <\/code> to allow Javascript functionality for the WebView<\/li>\n<li>AndroidManifest.xml &#8230; INTERNET permission &#8230; similar to Eclipse &#8230; to <i>Build-&gt;&#8221;Generate Signed APK&#8230;&#8221;<\/i> for Google Play publishing you need the extra &#8230; <code>  android:debuggable=\"false\"  <\/code> clause<\/li>\n<li>Tools-&gt;Android-&gt;AVD Manager &#8230; emulator organization and emulator deployment help &#8230; remains the case that it is best to start the emulator all the way to the home page at the simulated device (right swipe unlocking any locks you get) &#8230; then run and attach your mobile app to this pre-established connection<\/li>\n<\/ul>\n<p>Source code wise, of interest to the &#8220;middle game&#8221;, is &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/MainActivity.java_GETME\" title='MainActivity.java'>MainActivity.java<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/activity_main.xml_GETME\" title='activity_main.xml'>activity_main.xml<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/fragment_weblayout.xml_GETME\" title='fragment_weblayout'>fragment_weblayout.xml<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/AndroidManifest.xml_GETME\" title='AndroidManifest.xml'>AndroidManifest.xml<\/a><\/li>\n<\/ul>\n<p>Before leaving the &#8220;middle game&#8221; thoughts, sometimes you need to adjust the code of a WebView&#8217;s innards (especially) if you want to do away with any <i>&#8220;Back&#8221;<\/i> or <i>&#8220;Forward&#8221;<\/i> button mobile application functionality, because any escape from the WebView&#8217;s control is that mobile application being effectively lost for that session.   As such, the Morse Code programming HTML source code became <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/morsecode.html-GETME\" title='morsecode.html'>morsecode.html<\/a> (&#8230; and how we got there <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/morsecode.html-GETME\" title='morsecode.html'>morsecode.html<\/a> &#8230;) and the method of creating the email was made to use a PHP piece of supervised code as per <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/morsecode.php_GETME\" title='morsecode.php'>morsecode.php<\/a> (with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/morsecode.html\" title='click picture'>live run<\/a> non-mobile web page link) to cater for Android mobile WebView compatibility &#8230; and thanks to this useful <a target=_blank title='useful link' href='http:\/\/stackoverflow.com\/questions\/1352587\/convert-a-string-into-morse-code'>link<\/a>.<\/p>\n<p>And what of the &#8220;end game&#8221;? &#8230; Would direct you to the imagery of today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/Morsecodeemail\/\" title='Click picture'>tutorial<\/a> &#8230; a lot of it covers the same ground as the &#8220;Eclipse&#8221; corresponding scenario tutorial called <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2377\" title=\"Eclipse Android App Google Play Ready Primer Tutorial\">Eclipse Android App Google Play Ready Primer Tutorial<\/a>.<\/p>\n<p>Just to challenge you with a <i>&#8220;middle, end, start order&#8221;<\/i> &#8230; have a look at some information regarding Android Studio mobile development and the &#8220;start game&#8221; &#8230; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=6667\" title=\"Android Studio Primer Tutorial\">Android Studio Primer Tutorial<\/a>.<\/p>\n<p>Hope this is food for thought for your Android mobile development plans!   See the results of the work today at <a target=_blank title='Morse Code Email mobile app at Google Play' href='https:\/\/play.google.com\/store\/apps\/details?id=com.rjmprogramming.au.MorseCodeEmail'>Google Play<\/a>.<\/p>\n<hr \/>\n<p id='astttgt'>Previous relevant <a target=_blank title='Android Studio Tic Tac Toe Game Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=11956'>Android Studio Tic Tac Toe Game Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Android Studio Tic Tac Toe Game Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/AndroidStudio_TicTacToe-25of.jpg\" title=\"Android Studio Tic Tac Toe Game Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Android Studio Tic Tac Toe Game Tutorial<\/p><\/div>\n<p>Wonder if you were around when we created Tic Tac Toe (or more like Noughts and Crosses, in Australia) using the HTML5 Canvas element and drag and drop methods (if you liked, or just plain box clicking, otherwise, which will be okay for mobile usage) &#8230;  <a target=_blank title='HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial' href='#hjctttgdad'>HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial<\/a> as shown below?  Well, today, we turn that into an Android mobile application using Android Studio.<\/p>\n<p><a target=_blank title='Android Studio download' href='http:\/\/developer.android.com\/sdk\/'>Android Studio<\/a> is an alternative <a target=_blank title='ide info from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>IDE<\/a> to <a target=_blank title='eclipse download' href='https:\/\/eclipse.org\/downloads\/'>Eclipse<\/a> (and there are others too) to use the Android SDK and Java to develop mobile apps for an Android mobile device and in our aforesaid mentioned &#8220;start game&#8221;, &#8220;middle game&#8221; and &#8220;end game&#8221; view of mobile development we are just showing you the &#8220;middle game&#8221; today, but if you were to follow through &#8230; <a target=_blank title='fore information from Wikipedia ... thanks ... was going to spell it wrongly' href='http:\/\/en.wikipedia.org\/wiki\/Fore_%28golf%29'>fore<\/a>!!!!!!!! &#8230; and not shank &#8230; and not hook (ie. narrrrrrr &#8230; chortle, chortle) &#8230; then we may end up at <a target=_blank title='Google Play' href='https:\/\/play.google.com'>Google Play<\/a> with a mobile app &#8230; by the way, we talk about the &#8220;end game&#8221; at <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2377'>Eclipse Android App Google Play Ready Primer Tutorial<\/a> (Android Studio has all this functionality and capability too).<\/p>\n<p>So what are some of the concepts in the Android Studio project, for which huge help came from this great <a target=_blank title='Embed WebView in Fragment' href='http:\/\/android-er.blogspot.com.au\/2013\/04\/embed-webview-in-fragment.html'>link<\/a> &#8230; thanks &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Android fragments' href='http:\/\/www.i-programmer.info\/programming\/android\/6882-introducing-android-fragments.html'>Fragments<\/a> &#8211; components of the Android UI &#8230; and setting of startup fragment of interest &#8230; fragments go some way to addressing that common issue for mobile developers that all the UI elements of a mobile application fit and would ideally be displayed with a tablet but it would be best to only conditionally display some when it comes to using a smaller format mobile device such as an Android mobile phone device<\/li>\n<li>Layout in activity_main.xml &#8230; similar to Eclipse<\/li>\n<li>WebView &#8230; similar to Eclipse &#8230; allows an Internet web component in your Android mobile app<\/li>\n<li>Use of <code> myWebView.getSettings().setJavaScriptEnabled(true); <\/code> to allow Javascript functionality for the WebView<\/li>\n<li>AndroidManifest.xml &#8230; INTERNET permission &#8230; similar to Eclipse<\/li>\n<li>Tools-&gt;Android-&gt;AVD Manager &#8230; emulator organization and emulator deployment help &#8230; remains the case that it is best to start the emulator all the way to the home page at the simulated device (right swipe unlocking any locks you get) &#8230; then run and attach your mobile app to this pre-established connection<\/li>\n<\/ul>\n<p>Source code wise, of interest, is &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/MainActivity.java_GETME\" title='MainActivity.java'>MainActivity.java<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/activity_main.xml_GETME\" title='activity_main.xml'>activity_main.xml<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/layout_webfragment.xml_GETME\" title='layout_webfragment.xml'>layout_webfragment.xml<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/AndroidManifest.xml_GETME\" title='AndroidManifest.xml'>AndroidManifest.xml<\/a><\/li>\n<\/ul>\n<p>So that&#8217;s a bit about the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Android\/TicTacToe\/\" title='click picture'>mobile world<\/a>, and so concerning the innards of that WebView &#8230;<\/p>\n<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.<\/p>\n<p>In today&#8217;s tutorial we show some image Drag and Drop functionality that you can use with the Canvas HTML5 element where we create a Tic Tac Toe game webpage.   We thank w3schools for the great advice at this <a target=_blank href='http:\/\/www.w3schools.com\/html\/html5_draganddrop.asp' title='Drag and drop advice at w3schools'>link<\/a>.<\/p>\n<p>The Drag and Drop does not work well on tablets, but for own Tic Tac Toe game today we allow either a drag and drop approach, or a touch\/click approach.<\/p>\n<p>You may want to read more at <a target=_blank title='HTML Canvas Reference' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>HTML Canvas Reference<\/a> as a generic reference, or here, at the tutorial <a target=_blank title='javascript - How do I add a simple onClick event handler to a canvas element? - Stack Overflow' href='http:\/\/stackoverflow.com\/questions\/9880279\/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element'>javascript &#8211; How do I add a simple onClick event handler to a canvas element? &#8211; Stack Overflow<\/a>.<\/p>\n<p>As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.<\/p>\n<p>Link to some downloadable HTML programming code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html_GETME' title='tictactoe_chalkboard.html'>tictactoe_chalkboard.html<\/a>\n<\/p>\n<p>You&#8217;ll notice heavy use of the Javascript <a target=_blank title='Javascript Math.random() information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_random.asp'>Math.random()<\/a> function.<\/p>\n<p>We hope you enjoy this tutorial as a <a target=_blank title='Canvas HTML element live run tutorial'  href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html\">live run<\/a>.<\/p>\n<p>Should you find Tac Tac Toe (or even Noughts and Crosses) addictive you should see <a target=_blank title='Wargames' href='http:\/\/www.youtube.com\/watch?v=NHWjlCaIrQo'>this<\/a> &#8230; amazing!<\/p>\n<p>Yes &#8230; you&#8217;ve reached the end &#8230; <a target=_blank title='Click picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html'>go first<\/a> in each game and see if you can beat the computer!<\/p>\n<hr \/>\n<p id='hjctttgdadt'>Previous relevant <a target=_blank title='HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=8415'>HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/TicTacToe_Chalkboard.jpg\" id=\"dadi\" onmouseover=\" var iqw=document.getElementById('dadi'); iqw.src = iqw.src.replace('.jpg','.PNG').replace('.png','.jpg').replace('.PNG','.png'); \" title=\"HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML\/Javascript Canvas Tic Tac Toe Game Drag and Drop Tutorial<\/p><\/div>\n<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.<\/p>\n<p>In today&#8217;s tutorial we show some image Drag and Drop functionality that you can use with the Canvas HTML5 element where we create a Tic Tac Toe game webpage.   We thank w3schools for the great advice at this <a target=_blank href='http:\/\/www.w3schools.com\/html\/html5_draganddrop.asp' title='Drag and drop advice at w3schools'>link<\/a>.<\/p>\n<p>The Drag and Drop does not work well on tablets, but for own Tic Tac Toe game today we allow either a drag and drop approach, or a touch\/click approach.<\/p>\n<p>You may want to read more at <a target=_blank title='HTML Canvas Reference' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>HTML Canvas Reference<\/a> as a generic reference, or here, at the tutorial <a target=_blank title='javascript - How do I add a simple onClick event handler to a canvas element? - Stack Overflow' href='http:\/\/stackoverflow.com\/questions\/9880279\/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element'>javascript &#8211; How do I add a simple onClick event handler to a canvas element? &#8211; Stack Overflow<\/a>.<\/p>\n<p>As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.<\/p>\n<p>Link to some downloadable HTML programming code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html_GETME' title='tictactoe_chalkboard.html'>tictactoe_chalkboard.html<\/a>\n<\/p>\n<p>You&#8217;ll notice heavy use of the Javascript <a target=_blank title='Javascript Math.random() information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_random.asp'>Math.random()<\/a> function.<\/p>\n<p>We hope you enjoy this tutorial as a <a target=_blank title='Canvas HTML element live run tutorial'  href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html\">live run<\/a>.<\/p>\n<p>Should you find Tac Tac Toe (or even Noughts and Crosses) addictive you should see <a target=_blank title='Wargames' href='http:\/\/www.youtube.com\/watch?v=NHWjlCaIrQo'>this<\/a> &#8230; amazing!<\/p>\n<p>Yes &#8230; you&#8217;ve reached the end &#8230; <a target=_blank title='Click picture' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/tictactoe_chalkboard.html'>go first<\/a> in each game and see if you can beat the computer!<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d8415' onclick='var dv=document.getElementById(\"d8415\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=canvas\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d8415' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d11956' onclick='var dv=document.getElementById(\"d11956\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Android\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d11956' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d11956' onclick='var dv=document.getElementById(\"d11956\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=google-play\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d11956' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20168' onclick='var dv=document.getElementById(\"d20168\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=google-play\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20168' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20224' onclick='var dv=document.getElementById(\"d20224\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=mobile-phone\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20224' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d38802' onclick='var dv=document.getElementById(\"d38802\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/android\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d38802' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The concept of &#8220;Project Copy&#8221; in terms of discussing the Android Studio IDE creator of Android mobile applications is an interesting one. For us at least, what most comes to mind is that you &#8230; physically copy the Android Studio &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/android-studio-project-copy-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12,37],"tags":[76,77,78,80,2575,585,644,725,795,997,999,1319],"class_list":["post-38802","post","type-post","status-publish","format-standard","hentry","category-android","category-elearning","category-tutorials","tag-android","tag-android-app","tag-android-mobile","tag-android-studio","tag-gradle","tag-ide","tag-java","tag-mac-os-x","tag-mobile","tag-programming","tag-project","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/38802"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=38802"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/38802\/revisions"}],"predecessor-version":[{"id":38815,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/38802\/revisions\/38815"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=38802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=38802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=38802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}