Android course (lecture2)

Preview:

DESCRIPTION

 

Citation preview

1

Android CourseAmira Elsayed Ismail

2

Agenda Install Android SDK. Create Hello World Application. Testing your application on emulator. Testing your application on real device.

3

Install Android SDK Make sure you have Java JDK installed in

your computer check : C:\Program Files (x86)\Java

Download Eclipse IDE check : https://www.eclipse.org/downloads/

Download Android SDK check : http://developer.android.com/sdk/index.html

4

Install Android SDK (Cont’d) After you finish downloading, unzip

them to have the following :

Open Eclipse and try to create new Android project.

1

You will not be able to create Android project as you didn’t integrate Android SDK with Eclipse IDE yet.

2

You will need to install new software to add Android ADT Plugin to Eclipse IDE please check : http://developer.android.com/sdk/installing/installing-adt.html

3

4

5

6

After installation complete you will have to restart eclipse.

7In the SDK folder we will find SDK Manager, run it to open SDK installer, you will find a list with all available Android API

Android 4.4 is Kitkat

8Her I have installed difference versions to be able to test my application on different OS version like (2.1, 2.2, 3.2 and 4.2.2)

9Return back to eclipse to add the preference of our android SDK installation folder.

10

In Android Preferences Tab Browse for SDK location choose “sdk” inside “adt-bundle-……” and apply your changes

You can always be able to update your Android SDk and download latest Android API either from the SDK folder on your hard disk, or by accessing the following icon in eclipse toolbar.

You can also copy this folder that contains (eclipse , Android SDK) to any other Windows PC and just update the references and work again without need to reinstall and do all these steps again.

17

Create Hello World Application We will create a small application that

print “Hello World” on mobile screen.

1

Open Eclipse and try to create new Android project.

You will find a new tab for Android projects.

You have 4 options :Android Application Project : to create new android project

Android Project from Existing Code: Will let you open/import a project that already exist

Android Sample Project: if you download Sample projects that came with SDK, you will be able to open them.

2

1- Enter application name that will be shown when you install application on your device.

2- Enter project name and package name.

3- Choose Minimum SDk : The Android system will prevent the user from installing the application if the system's API Level is lower than min SDK.

4- Choose Target SDK: This attribute informs the system that you have tested against the target version and all versions after it.

3

1- Select create launcher icon to create app icon, and you can change it later.

2- Select create activity to create the first activity in your project.

3- Press next.

4

1- Here you can browse and choose application icon, or just use default android icon, you can change it later.

2- You can also choose the background color of the first activity that you have created.

5

1- Here you can choose the type of your activity (Blank, Full Screen in case of games OR Master/Details Flow)

6

1-Now enter the activity layout name and activity class name.

7

1- Congratulation, you have just finish creating your first android application (Hello World!!)

8

26

Testing your application on emulator Now we will show how to define Virtual

Device Emulator to be able to test our application.

You can access AVD Manager from SDK folder, or using Android Virtual Device Manager from eclipse toolbar1

You will find list of all virtual devices that you have already define, and by pressing NEW you will be able to define a new one.2

Enter required data like (Name, Device, Target SDK, etc…) and press OK3

You will have a confirmation message with the virtual device details.4

Result of running your first application, You have did a great job.5

32

Testing your application on real device. To be able to run your application on

your mobile device: Connect your device using USB cabel. Make sure you have installed your device

drivers. Follow the instructions in the next slide

34

Recommended