DOC

Development in NetBeans

By Rodney Nichols,2014-11-11 13:44
11 views 0
Development in NetBeans

    Android Development Using Windows and NetBeans 6.9

1. Download the Android SDK, installer_r11-windows.exe, from:

     http://developer.android.com/sdk/index.html

    2. Install the SDK. On the second dialog, it may come up saying it can’t find the JDK or it

    is the wrong version. So you may have to “help” it find the latest JDK (e.g., C:\Program

    Files\Java\jdk1.6.0_20). You can default on everything else, it doesn’t take long to

    install.

    3. Start the Android SDK Manager. If it doesn’t start, look at Control Panel -> System

    Properties -> Advanced tab -> Environment Variables -> Path. Make sure the path to the

    Java SDK bin (e.g., C:\Program Files\Java\jdk1.6.0_20\bin) is before that for

    windows\system32 and that for any other path that may have a version of java.exe in it. 4. Install all the packages from Android SDK Manager. This can take awhile (hour or so). 5. Install the nbandroid plugin for NetBeans:

    a. Start NetBeans

    b. Tools -> Plugins -> Settings Tab, Click Add

    c. In Dialog, Leave “Check for updates …” Check. Put Name: Android Plugin

    URL: http://kenai.com/downloads/nbandroid/updatecenter/updates.xml

    d. Go to the Available Plugins tab, click on checkbox for Android and click Install

    e. Proceed through the installation it will say it is not trusted, that’s OK.

    6. Tell NetBeans where the Android SDK is:

    a. Tools -> Options -> Miscellaneous, choose Android Tab, Browse to where you

    installed it, e.g., C:\Program Files\Android\android-sdk and click OK 7. Start a new Android Project: File -> New Project, Choose Android and Android Project

    a. Pick Name, Location as you do for Java programs

    b. Leave Set as Main Project checked.

    c. Choose an Activity Name (name will show as App Activity when installed)

    d. Choose a Package Name (like Java packages, use dotted name: xxx.yyy

    e. Choose an Android Platform. Try Android 2.2. It is easy to change it and rebuild

    later.

    8. Hello World App

    a. Open the Java Source Code for your Activity

    b. Add the import: import android.widget.TextView;

    c. Modify the OnCreate method and replace the setContentView line with:

    TextView tv = new TextView(this);

    tv.setText("Hello World! ");

    setContentView(tv);

    d. Build it: Run -> Build Main Project

    9. Create a Simulator (Android Virtual Device)

    a. Start the Android SDK Manager

    b. Choose Virtual Devices and click New

    c. Pick a Name, like MyDevice_2_2 and a Target, like Android 2.2.

    d. Default on rest and click “Create AVD”

    10. Run your program on the virtual device

    a. From Netbeans, select Run -> Run Main Project

    b. If you have more than one AVD, it will ask you to choose one

null

Report this document

For any questions or suggestions please email
cust-service@docsford.com