Академический Документы
Профессиональный Документы
Культура Документы
Disclaimer
Portions of this presentation are modifications based on work created and shared by the Android Open Source Project
> http://code.google.com/policies.html
They are used according to terms described in the Creative Commons 2.5 Attribution License
> http://creativecommons.org/licenses/by/2.5/
Get you be exposed to the basic building blocks of an Android application in a cursory manner
> The details will be covered in the rest of the
course
Topics
Installation and configuration Building blocks of Android application
> > > > >
Software Needed
JDK (Java Development Kit)
> Android application is Java application
Eclipse IDE
> Editor, Debugger, profiler, deployment
Android SDK
> Libraries, samples, documentation, handset
environment
AndroidManifest.xml R.java (automatically created from resource files) Android library (automatically configured)
10
Activity Class
Each Activity class typically represents a screen
> Like a JSP page in a Web application
The onCreate() method of Activity class gets called by the Android system when your Activity starts
> You create your UI inside the onCreate() method
Every Activity has to be described in the AndroidManifest.xml file An Activity is typically chosen as a starting one of your application - like a class that has a main() method in Java
> Special configuration in AndroidManifest.xml
11
12
Each activity class specifies which layout resource file to use for each screen it represents
> Using setContentView(R.layout.main);
13
14
The strings are then referred to through the names assigned to them
> The mapping is done through R.java
15
16
AndroidManifest.xml file
Every application must have a manifest file called AndroidManifest.xml file (with precisely that name) in its root directory. The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code.
17
the application.
Activities
> One activity is designated as a starting Activity
<activity android:name=".HelloWorldActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 18
AndroidManifest.xml
19
R.java
Automatically created by Android system for all resources defined
20
R.java
21
Thank you!