Android Applications: A top-
down perspective
Chao-Chueh Chang
Outline
• Development environment
• Components of an Android application
• Debugging
Architecture of Android
Java
C/C++
C
JNI
Development Environment
• Java development kit (version 1.6 or higher)
• Android SDK
– Java classes for Android components...
Installing ADT/SDK/NDK
• Installing ADT in Eclipse
– Start Eclipse, then select Help > Install New Software
– In the Avail...
Initializing a Project
• File -> New -> Android Application Project
• Helloworld!
Application Components
• Application properties: AndroidManifest.xml
– Presents essential information about the applicatio...
Generating Application
Resource
files
R.java
*.java
*.class *.dex
.apk
AndroidManifest
C/C++ files *.so
Android Key Components
• Activity
– UI
– One activity at a time
• Service
– May continue working even the application is n...
Activity Lifecycle
• onCreate()
– Set up activity layout
• onStart()
– Set event listener
– Run methods
– Initialize servi...
Service Lifecycle
• onStart()
– Initializing threads
• onBind()
– Passing parameters to
this instance
Broadcast Receiver
1. Initialize IntentFilter
2. add actions
3. Initialize
BroadcastReceiver and
overrides onReceive
4. re...
Compiling Codes Through NDK
• Claim native methods in Java
• Generates JNI header by javah
• Write C/C++ program
• Android...
Android Virtual Device
• Simulating events
– Incoming calls, SMS…
• No support for the following items
– placing or receiv...
Debugging Tools
• sdk/platform-tool/adb
– adb logcat
– ADT in Eclipse
• addr2line, objdump, readelf
Upcoming SlideShare
Loading in...5
×

Android app development: a top-down perspective

268

Published on

this slides describes a top-down perspective Android development process

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
268
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Android app development: a top-down perspective

  1. 1. Android Applications: A top- down perspective Chao-Chueh Chang
  2. 2. Outline • Development environment • Components of an Android application • Debugging
  3. 3. Architecture of Android Java C/C++ C JNI
  4. 4. Development Environment • Java development kit (version 1.6 or higher) • Android SDK – Java classes for Android components • IDE – Google recommends Eclipse 3.4 or 3.5 • Android Development Tool (ADT) for Eclipse • Android NDK (optional) – Tool chain for compiling C/C++ into shared object files
  5. 5. Installing ADT/SDK/NDK • Installing ADT in Eclipse – Start Eclipse, then select Help > Install New Software – In the Available Software dialog, click Add... • In the Add Site dialog that appears, enter this URL in the "Location" field. – https://dl-ssl.google.com/android/eclipse/ • Or download the ADT plugin zip file and click Archive in the Available Software dialog – Next, next, next… • Configuring the Android SDK – Run Android SDK manager and download “SDK Platform” – Select Window > Preferences > Android – Browse and select your SDK directory • Add /path/to/your/ndk/directory/ to $PATH
  6. 6. Initializing a Project • File -> New -> Android Application Project • Helloworld!
  7. 7. Application Components • Application properties: AndroidManifest.xml – Presents essential information about the application • Resource xml files ( /res) – View layout, images, sounds, and etc… • Generated code ( /gen) – ADT generates a java file that includes resources and the corresponding ID • Source code ( /src , /jni ) – Generates shared object files through NDK – Generates .class files through eclipse • Object files ( /obj), Library files ( /libs)
  8. 8. Generating Application Resource files R.java *.java *.class *.dex .apk AndroidManifest C/C++ files *.so
  9. 9. Android Key Components • Activity – UI – One activity at a time • Service – May continue working even the application is not in the foreground – Expose method interface to Activity (like Java RMI) • Broadcast receiver – Listen to specific action(s) – IPC • Content provider – SQL-like
  10. 10. Activity Lifecycle • onCreate() – Set up activity layout • onStart() – Set event listener – Run methods – Initialize service or BroadcastReceiver • onStop() – Do cleaning methods
  11. 11. Service Lifecycle • onStart() – Initializing threads • onBind() – Passing parameters to this instance
  12. 12. Broadcast Receiver 1. Initialize IntentFilter 2. add actions 3. Initialize BroadcastReceiver and overrides onReceive 4. register 5. unregister IntentFilter filter = new IntentFilter(); Filter.addAction(WifiManager. WIFI_STATE_CHANGED_ACTION); BroadcastReceiver br = new BroadcastReceiver(){ onReceive(){ … } }; registerReceiver(br, filter); unregisterReceiver( br );
  13. 13. Compiling Codes Through NDK • Claim native methods in Java • Generates JNI header by javah • Write C/C++ program • Android.mk – include $(BUILD_SHARED_LIBRARY) • ndk-build
  14. 14. Android Virtual Device • Simulating events – Incoming calls, SMS… • No support for the following items – placing or receiving actual phone calls – USB connections – camera/video capture (input) – device-attached headphones – determining connected state – determining battery charge level and AC charging state – determining SD card insert/eject – Bluetooth
  15. 15. Debugging Tools • sdk/platform-tool/adb – adb logcat – ADT in Eclipse • addr2line, objdump, readelf
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×