Setting Android IDE

download Setting Android IDE

of 39

Transcript of Setting Android IDE

  • 7/27/2019 Setting Android IDE

    1/39

  • 7/27/2019 Setting Android IDE

    2/39

    The system requirements are:

    JDK (Java Development Kit)

    JRE (Java Runtime Environment)

    Android SDK Eclipse + ADT plugin

    Android SDK Tools

    Android Platform-tools The latest Android platform

    The latest Android system image for the emulator

  • 7/27/2019 Setting Android IDE

    3/39

    The minimum system requirements are: JDK, JRE,

    Android SDK

    STEP 1:

    1. Installing JRE (Java Run Time Environment) It Covers end-users need. Contains everything required

    to run Java applications on your system.

    Link:

    http://www.oracle.com/technetwork/java/javase/downlo

    ads/index.html

    http://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.html
  • 7/27/2019 Setting Android IDE

    4/39

    STEP 1:

    1. Select JRE

    2. Accept the License

    agreement. 3. Select either Windows (32

    bit or 64 bit), depending on

    your OS configurations. Install

    the software.

    2. Accept the License agreement.

    3. Select either Windows (32 bit or 64 bit), depending on your OS configurations. Install the software.

    2. Accept the License agreement.

    3. Select either Windows (32 bit or 64 bit), depending on your OS configurations. Install the software.

  • 7/27/2019 Setting Android IDE

    5/39

  • 7/27/2019 Setting Android IDE

    6/39

    STEP 2:

    1. Select JDK

    2. Accept the License

    agreement. 3. Select either Windows

    (32 bit or 64 bit),

    depending on your OS

    configurations. Install thesoftware.

  • 7/27/2019 Setting Android IDE

    7/39

  • 7/27/2019 Setting Android IDE

    8/39

    For checking whether Java is installed properly click on

    the following link:

    Java Verifier

    http://www.java.com/en/download/installed.jsp

    Click on Verify Java Version.

    Link will verify the version of java.

    http://www.java.com/en/download/installed.jsphttp://www.java.com/en/download/installed.jsp
  • 7/27/2019 Setting Android IDE

    9/39

    STEP 3

    3. Downloading & Installing the Android SDK The Android SDK provides you the API libraries and developer

    tools necessary to build, test, and debug apps for Android.

    Link : http://developer.android.com/sdk/index.html#download

    With a single download, the ADT Bundle includes everything youneed to begin developing apps:

    Eclipse + ADT plugin

    Android SDK Tools

    Android Platform-tools

    The latest Android platform

    The latest Android system image for the emulator

    http://developer.android.com/sdk/index.htmlhttp://developer.android.com/sdk/index.html
  • 7/27/2019 Setting Android IDE

    10/39

  • 7/27/2019 Setting Android IDE

    11/39

    Once the software is downloaded unzip the sdk.

    Open the Eclipse folder and install Eclipse. Aworkspace launcher will pop up and Select ok to create

    a Workspace.

    Open the folder: adt-bundle-windows-x86-

    20130219\sdk\tools

    Double click Android. This will install the Android

    SDK Manager

    The Android SDK separates tools, platforms, and othercomponents into packages you can download using the

    SDK Manager.

  • 7/27/2019 Setting Android IDE

    12/39

  • 7/27/2019 Setting Android IDE

    13/39

    srcyour source code

    genauto-generated code (usually just R.java)

    Included libraries

    Resources Drawables (like .png images)

    Layouts

    Values (like strings)

    Manifest file

  • 7/27/2019 Setting Android IDE

    14/39

    Used to define some of the resources Layouts (UI)

    Strings

    Manifest file

    Preferred way of creating UIs Separates the description of the layout from any actual code

    that controls it

    Can easily take a UI from one platform to another

  • 7/27/2019 Setting Android IDE

    15/39

    Auto-generated: never edit this file

    Contains IDs of the project resources

    Enforces good software engineering

    Use findViewById and Resources object to get access

    to the resources

    Ex. Button b = (Button)findViewById(R.id.button1)

    Ex. getResources().getString(R.string.hello));

  • 7/27/2019 Setting Android IDE

    16/39

    Eclipse has a great UI creator Generates the XML for you

    Composed of Viewobjects

    Can be specified for portrait and landscape mode

    Use same file name, so can make completely different UIs for

    the orientations without modifying any code

  • 7/27/2019 Setting Android IDE

    17/39

  • 7/27/2019 Setting Android IDE

    18/39

    Click Create to make layout modifications.

    When in portrait mode can select Portrait to make a res sub

    folder for portrait layouts

    Likewise for Landscape layouts while in landscape mode

    Will create folders titled layout-port and layout-land

  • 7/27/2019 Setting Android IDE

    19/39

    Note: these port and land folders are examples ofalternate layouts, see here for more info http://developer.android.com/guide/topics/resources/providing-resources.html

    Avoid errors by making sure components have the same id in

    both orientations, and that youve tested each orientation

    thoroughly

    http://developer.android.com/guide/topics/resources/providing-resources.htmlhttp://developer.android.com/guide/topics/resources/providing-resources.htmlhttp://developer.android.com/guide/topics/resources/providing-resources.htmlhttp://developer.android.com/guide/topics/resources/providing-resources.html
  • 7/27/2019 Setting Android IDE

    20/39

  • 7/27/2019 Setting Android IDE

    21/39

    In res/values

    strings.xml

    Application wide available strings

    Promotes good software engineering

    UI components made in the UI editor should havetext defined in strings.xml

    Strings are just one kind of Value there are manyothers

  • 7/27/2019 Setting Android IDE

    22/39

    Contains characteristics about your application

    When have more than one Activity in app, NEED to

    specify it in manifest file

    Go to graphical view of the manifest file

    Add an Activity in the bottom right

    Browse for the name of the activity

    Need to specify Services and other components too

    Also important to define permissions and external

    libraries, like Google Maps API

  • 7/27/2019 Setting Android IDE

    23/39

  • 7/27/2019 Setting Android IDE

    24/39

    Activity

    http://developer.android.com/guide/topics/fundamentals/activi

    ties.html

    Service

    http://developer.android.com/guide/topics/fundamentals/services.html

    Content Providers

    Broadcast Receivers

    Android in a nutshell:

    http://developer.android.com/guide/topics/fundamentals.html

    http://developer.android.com/guide/topics/fundamentals/activities.htmlhttp://developer.android.com/guide/topics/fundamentals/activities.htmlhttp://developer.android.com/guide/topics/fundamentals/services.htmlhttp://developer.android.com/guide/topics/fundamentals/services.htmlhttp://developer.android.com/guide/topics/fundamentals.htmlhttp://developer.android.com/guide/topics/fundamentals.htmlhttp://developer.android.com/guide/topics/fundamentals/services.htmlhttp://developer.android.com/guide/topics/fundamentals/services.htmlhttp://developer.android.com/guide/topics/fundamentals/activities.htmlhttp://developer.android.com/guide/topics/fundamentals/activities.html
  • 7/27/2019 Setting Android IDE

    25/39

    The basis of android applications A single Activity defines a single viewable screen

    the actions, not the layout

    Can have multiple per application

    Each is a separate entity They have a structured life cycle

    Different events in their life happen either via the usertouching buttons or programmatically

  • 7/27/2019 Setting Android IDE

    26/39

  • 7/27/2019 Setting Android IDE

    27/39

    Run in the background

    Can continue even if Activity that started it dies

    Should be used if something needs to be done while the user isnot interacting with application

    Otherwise, a thread is probably more applicable

    Should create a new thread in the service to do work in, sincethe service runs in the main thread

  • 7/27/2019 Setting Android IDE

    28/39

    Can be bound to an application It terminates when all applications bound to it unbind

    Allows multiple applications to communicate with it via acommon interface

    Needs to be declared in manifest file

    Like Activities, has a structured life cycle

  • 7/27/2019 Setting Android IDE

    29/39

  • 7/27/2019 Setting Android IDE

    30/39

    A bound service is the serverin a client-serverinterface.

    A bound service allows components (such as activities)

    to bind to the service, send requests, receive

    responses, and even perform interprocess

    communication (IPC).

    A bound service typically lives only while it serves

    another application component and does not run in thebackground indefinitely.

  • 7/27/2019 Setting Android IDE

    31/39

    In this case, an application component starts theservice, and it would continue to run in the background,

    even if the original component that initiated it is

    destroyed.

    For instance, when started, a service would continue to

    play music in the background indefinitely.

  • 7/27/2019 Setting Android IDE

    32/39

    Similar to launching a regular Java app, use the launch

    configurations

    Specify an Android Application and create a new one

    Specify activity to be run

    Can select a manual option, so each time program isrun, you are asked whether you want to use the actual

    phone or the emulator Otherwise, it should be smart and use whichever one is

    available

  • 7/27/2019 Setting Android IDE

    33/39

  • 7/27/2019 Setting Android IDE

    34/39

  • 7/27/2019 Setting Android IDE

    35/39

  • 7/27/2019 Setting Android IDE

    36/39

    Should be enabled on phone to use developer features

    In the main apps screen select Settings -> Applications

    -> Development -> USB debugging (it needs to be

    checked)

  • 7/27/2019 Setting Android IDE

    37/39

    Used for a wide variety of developer tasks Read from the log file

    Show what android devices are available

    Install android applications (.apk files)

    In the platform-tools directory of the main androidsdk directory

    Recommend putting this directory and the tools directory on

    the system path

    adb.exe

  • 7/27/2019 Setting Android IDE

    38/39

    Instead of using traditional System.out.println, use the Log

    class Imported with android.util.Log Multiple types of output (debug, warning, error, ) Log.d(,)

    Can be read using logcat.

    Print out the whole log, which auto-updates adb logcat

    Erase log adb logcatc

    Filter output via tags adb logcat : *:S can have multiple : filters corresponds to debug, warning, error, etc. If use Log.d(), then = D

  • 7/27/2019 Setting Android IDE

    39/39

    One option: Android Screen Capture http://www.mightypocket.com/2010/08/android-screenshots-

    screen-capture-screen-cast/

    Its slow, but fine for screenshots of applications whose screensarent changing fast

    http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/