34
Android Course Amira Elsayed Ismail 1

Android course (lecture2)

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Android course (lecture2)

1

Android CourseAmira Elsayed Ismail

Page 2: Android course (lecture2)

2

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

Page 3: Android course (lecture2)

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

Page 4: Android course (lecture2)

4

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

them to have the following :

Page 5: Android course (lecture2)

Open Eclipse and try to create new Android project.

1

Page 6: Android course (lecture2)

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

2

Page 7: Android course (lecture2)

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

Page 8: Android course (lecture2)

4

Page 9: Android course (lecture2)

5

Page 10: Android course (lecture2)

6

After installation complete you will have to restart eclipse.

Page 11: Android course (lecture2)

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

Page 12: Android course (lecture2)

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)

Page 13: Android course (lecture2)

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

Page 14: Android course (lecture2)

10

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

Page 15: Android course (lecture2)

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.

Page 16: Android course (lecture2)
Page 17: Android course (lecture2)

17

Create Hello World Application We will create a small application that

print “Hello World” on mobile screen.

Page 18: Android course (lecture2)

1

Open Eclipse and try to create new Android project.

Page 19: Android course (lecture2)

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

Page 20: Android course (lecture2)

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

Page 21: Android course (lecture2)

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

Page 22: Android course (lecture2)

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

Page 23: Android course (lecture2)

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

6

Page 24: Android course (lecture2)

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

7

Page 25: Android course (lecture2)

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

8

Page 26: Android course (lecture2)

26

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

Device Emulator to be able to test our application.

Page 27: Android course (lecture2)

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

Page 28: Android course (lecture2)

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

Page 29: Android course (lecture2)

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

Page 30: Android course (lecture2)

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

Page 31: Android course (lecture2)

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

Page 32: Android course (lecture2)

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

Page 33: Android course (lecture2)
Page 34: Android course (lecture2)

34