Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2303C9056 for ; Thu, 5 Apr 2012 19:02:12 +0000 (UTC) Received: (qmail 81939 invoked by uid 500); 5 Apr 2012 19:02:12 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 81912 invoked by uid 500); 5 Apr 2012 19:02:11 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 81842 invoked by uid 99); 5 Apr 2012 19:02:11 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2012 19:02:11 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 878C7B246; Thu, 5 Apr 2012 19:02:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hermwong@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [2/38] docs commit: Updated Android Getting Started guide for 1.6.0. Message-Id: <20120405190211.878C7B246@tyr.zones.apache.org> Date: Thu, 5 Apr 2012 19:02:11 +0000 (UTC) Updated Android Getting Started guide for 1.6.0. Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/6e95a9aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/6e95a9aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/6e95a9aa Branch: refs/heads/master Commit: 6e95a9aafe699b963af44e3c635f063090867e46 Parents: 97b5fdd Author: Bryce Curtis Authored: Tue Apr 3 22:46:15 2012 -0500 Committer: hermwong Committed: Thu Apr 5 10:52:06 2012 -0700 ---------------------------------------------------------------------- .../en/edge/guide/getting-started/android/index.md | 66 ++++++++------- .../guide/getting-started/android/buildPath.jpg | Bin 0 -> 80516 bytes .../img/guide/getting-started/android/javaSrc.jpg | Bin 420745 -> 141340 bytes .../img/guide/getting-started/android/manifest.jpg | Bin 247181 -> 268212 bytes 4 files changed, 35 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/6e95a9aa/docs/en/edge/guide/getting-started/android/index.md ---------------------------------------------------------------------- diff --git a/docs/en/edge/guide/getting-started/android/index.md b/docs/en/edge/guide/getting-started/android/index.md index 9460a42..2ecd2e4 100644 --- a/docs/en/edge/guide/getting-started/android/index.md +++ b/docs/en/edge/guide/getting-started/android/index.md @@ -3,51 +3,55 @@ Getting Started with Android This guide describes how to set up your development environment for Cordova and run a sample application. Note that Cordova used to be called PhoneGap, so some of the sites still use the old PhoneGap name. -Video Tutorials: ----------------- - -- [Cordova and Android Quick Start Video Using Ecliplse](http://www.youtube.com/v/MzcIcyBYJMA?autoplay=1) - 1. Requirements --------------- - Eclipse 3.4+ -There is also a [Terminal](http://wiki.phonegap.com/w/page/30864168/phonegap-android-terminal-quickstart) of this tutorial that doesn't use Eclipse. - 2. Install SDK + Cordova ----------------------------- +------------------------ - Download and install [Eclipse Classic](http://www.eclipse.org/downloads/) - Download and install [Android SDK](http://developer.android.com/sdk/index.html) - Download and install [ADT Plugin](http://developer.android.com/sdk/eclipse-adt.html#installing) -- Donwload the latest copy of [Cordova](http://phonegap.com/download) and extract its contents. We will be working with the Android directory. +- Download the latest copy of [Cordova](http://phonegap.com/download) and extract its contents. We will be working with the Android directory. 3. Setup New Project ------------------------ +--------------------- -- Launch Eclipse, then under the menu select **New > Android Project** +- Launch Eclipse, and select menu item **New > Android Project**. Fill out the three panels of the **New Android Project** wizard shown below. ![](img/guide/getting-started/android/AndroidFlow.png) -- In the root directory of the project, create two new directories: + +- In the root directory of your project, create two new directories: - **/libs** - **assets/www** - Copy **cordova-1.6.0.js** from your Cordova download earlier to **assets/www** - Copy **cordova-1.6.0.jar** from your Cordova download earlier to **/libs** - Copy **xml** folder from your Cordova download earlier to **/res** -- Make a few adjustments too the project's main Java file found in the **src** folder in Eclipse: (view image below) + +- Verify that **cordova-1.6.0.jar** is listed in the Build Path for your project. Right click on the /libs folder and go to **Build Paths/ > Configure Build Path...**. Then, in the Libraries tab, add **cordova-1.6.0.jar** to the project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again. + + ![](img/guide/getting-started/android/buildPath.jpg) + +- Edit your project's main Java file found in the **src** folder in Eclipse: + - Add **import org.apache.cordova.*;** - Change the class's extend from **Activity** to **DroidGap** - Replace the **setContentView()** line with **super.loadUrl("file:///android_asset/www/index.html");** - - Add **import org.apache.cordova.*;** ![](img/guide/getting-started/android/javaSrc.jpg) -- You might experience an error here, where Eclipse can't find cordova-1.6.0.jar. In this case, right click on the /libs folder and go to Build Paths/ > Configure Build Paths. Then, in the Libraries tab, add cordova-1.6.0.jar to the Project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again. -- Right click on AndroidManifest.xml and select **Open With > Text Editor** -- Paste the following permissions under versionName: (view image below) - - + +- Right click on AndroidManifest.xml and select **Open With > XML Editor** +- Paste the following permissions between the **<uses-sdk.../>** and **<application.../>** tags. + + @@ -61,17 +65,22 @@ There is also a [Terminal](http://wiki.phonegap.com/w/page/30864168/phonegap-and - + + -- Add `android:configChanges="orientation|keyboardHidden"` to the activity tag in AndroidManifest. (view image below) +- Support orientation changes by pasting the folowing inside the **<activity>** tag. + + android:configChanges="orientation|keyboardHidden" - ![](img/guide/getting-started/android/manifest.jpg) +- Your AndroidManifest.xml file should look like + + ![](img/guide/getting-started/android/manifest.jpg) 4. Hello World -------------- -Now create and open a new file named **index.html** in the **assets/www** directory. Paste the following code: +- Create and open a new file named **index.html** in the **assets/www** directory. Paste the following code: @@ -83,26 +92,21 @@ Now create and open a new file named **index.html** in the **assets/www** direct

Hello World

- - *cordova-1.6.0.js might need to be replaced with latest cordova-.js 5A. Deploy to Simulator ----------------------- -- Right click the project and go to **Run As** and click **Android Application** +- Right click the project and go to **Run As > Android Application** - Eclipse will ask you to select an appropriate AVD. If there isn't one, then you'll need to create it. 5B. Deploy to Device -------------------- -- Make sure USB debugging is enabled on your device and plug it into your system. (Settings > Applications > Development) -- Right click the project and go to **Run As** and click **Android Application** +- Make sure USB debugging is enabled on your device and plug it into your system. (**Settings > Applications > Development**) +- Right click the project and go to **Run As > Android Application** Done! ----- - -You can also checkout more detailed version of this guide [here](http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart). - http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/6e95a9aa/template/docs/default/img/guide/getting-started/android/buildPath.jpg ---------------------------------------------------------------------- diff --git a/template/docs/default/img/guide/getting-started/android/buildPath.jpg b/template/docs/default/img/guide/getting-started/android/buildPath.jpg new file mode 100755 index 0000000..ae3f7ee Binary files /dev/null and b/template/docs/default/img/guide/getting-started/android/buildPath.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/6e95a9aa/template/docs/default/img/guide/getting-started/android/javaSrc.jpg ---------------------------------------------------------------------- diff --git a/template/docs/default/img/guide/getting-started/android/javaSrc.jpg b/template/docs/default/img/guide/getting-started/android/javaSrc.jpg index f35b0da..ab93051 100644 Binary files a/template/docs/default/img/guide/getting-started/android/javaSrc.jpg and b/template/docs/default/img/guide/getting-started/android/javaSrc.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/6e95a9aa/template/docs/default/img/guide/getting-started/android/manifest.jpg ---------------------------------------------------------------------- diff --git a/template/docs/default/img/guide/getting-started/android/manifest.jpg b/template/docs/default/img/guide/getting-started/android/manifest.jpg index 1e25330..6039194 100644 Binary files a/template/docs/default/img/guide/getting-started/android/manifest.jpg and b/template/docs/default/img/guide/getting-started/android/manifest.jpg differ