Android Training Part 1
RGUIG Saad - AIMAF
Android
1lundi 21 janvier 13
Morning Program :
1.General Introduction
2.Environment Setup
3.HelloWorl Application
4.Android Application Anatomy
Android
2lundi 21 janvier 13
General Introduction : Android
3lundi 21 janvier 13
General Introduction : Android
Android has more than 48 percent of the smartphone market, versus 32 percent for iOS. Google indicates there are 850,000 Android device activations per day and total Google Play app downloads have reached more than 15 billion. App search firm Xyologic reports that in March 2012 there were 617 million app downloads on Android versus 393 million app downloads on iPhone in the U.S.
4lundi 21 janvier 13
General Introduction : Android
5lundi 21 janvier 13
General Introduction : Android
1.0 ASTRO
6lundi 21 janvier 13
General Introduction : Android
1.5 Cupcake
7lundi 21 janvier 13
General Introduction : Android
1.6 Donut
8lundi 21 janvier 13
General Introduction : Android
2.1 Eclair
9lundi 21 janvier 13
General Introduction : Android
2.2 Froyo
10lundi 21 janvier 13
General Introduction : Android
2.3 Gingerbread
11lundi 21 janvier 13
General Introduction : Android
3 Honycomb
12lundi 21 janvier 13
General Introduction : Android
2.4 Ice Cream Sandwich
13lundi 21 janvier 13
General Introduction : Android
4.1 Jellybean
14lundi 21 janvier 13
AndroidEnvironment Setup
Environment Setup Steps
15lundi 21 janvier 13
AndroidHello World Application
Create a new Application
16lundi 21 janvier 13
AndroidHello World Application
Eclipse Android Perspective
17lundi 21 janvier 13
AndroidHello World Application
Application Installation on device
18lundi 21 janvier 13
AndroidHello World Application
Test the App
Emulator Phone19lundi 21 janvier 13
AndroidHello World Application
Android project anatomy
src/ – Source folder contains all your Java source code
gen/ – Generated folder contains source code generated by Android/Eclipse.It contains R.java – one of Android’s most important file to perform name lookup/resolution and referencing.R.java is automatically generated by the build system and references your resources.
assets/ – Assets folder contains static files such as html which can be included in your program.
res/ – Resource folder contains your program resource files.
res/drawables/ – Contains image files eg. PNG, JPG etc but also drawables which are specified in XML format
res/layouts/ – Contains XML files to specify your application View layouts
res/values/ – Contains XML files where you can specify static string,text, numeric and other constant values.
libs/ – A folder containing third-party/downloaded JAR libraries which can be used in your Android App.
AndroidManifest.xml – A manifest file where you can specify all you Activities, Permissions, and other configurations.
20lundi 21 janvier 13
AndroidHello World Application
Android project anatomy<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="fr.aimaf" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="fr.aimaf.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
21lundi 21 janvier 13
AndroidHello World Application
Android project anatomy
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" >
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/hello_world" />
</RelativeLayout>
22lundi 21 janvier 13
AndroidHello World Application
Android Activity Life cycle
23lundi 21 janvier 13
AndroidHello World Application
Android Activity Life cycle
Method Description
onCreate()
Called when the activity is first created. This is where you should do all of your normal static set up — create views, bind data to lists, and so on. This method is passed a Bundle object containing the activity's previous state, if that state was captured (see Saving Activity State, later).Always followed by onStart().
onReStart()Called after the activity has been stopped, just prior to it being started again.Always followed by onStart()
onStart()Called just before the activity becomes visible to the user.Followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
24lundi 21 janvier 13
AndroidHello World Application
Android Activity Life cycle
onResume()Called just before the activity starts interacting with the user. At this point the activity is at the top of the activity stack, with user input going to it.Always followed by onPause().
onPause()
Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns.Followed either by onResume() if the activity returns back to the front, or by onStop() if it becomes invisible to the user.
onStop()
Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly, because the next activity will not be resumed until it returns.Followed either by onResume() if the activity returns back to the front, or by onStop() if it becomes invisible to the user.
onDestroy()Called before the activity is destroyed. This is the final call that the activity will receive. It could be called either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with theisFinishing() method.
25lundi 21 janvier 13
AndroidHello World Application
Android Activity Life cycle
public class MainActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }}
26lundi 21 janvier 13
Android
27lundi 21 janvier 13
Top Related