Professional Documents
Culture Documents
(Chin-Feng Lai)
Assistant Professor, institute of CSIE, National Ilan University Nov. 10th 2011
2011 MMN Lab. All Rights Reserved
2011
Outline
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
Content Provider
Share data between applications
Service
A Service is an application component that can perform long-running operations in the background and does not provide a user interface
Activity Lifecycle
Activity1
onStart
Activity2 Activity1
onPause
Activity2 Activity1
onRestart
onStop
onDestory
Activity2 Activity1
onStart
Activity2 Activity1
running
Activity1
onStop onDestory
ContentProvider
Query() Insert() Delete() Update() ..
./data/data/.
Network
DataBase (sqlite3)
File
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
11
12
Compare traditional stack-based JVM with register-based JVM Before interpret A=B+C Stack-based ILOAD C ILOAD B IADD ISTORE A Register-based IADD A B C
13
14
Dex Converter
15
Jar to Dex
16
zygote
zygote
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
18
19
20
21
22
23
24
25
26
27
28
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
29
30
SDK version
Layout file
Activity definition
31
33
34
35
36
View Hierarchy
37
<?xml version="1.0" encoding="utf-8"?> <resources> <string name=mmn">how are you mad</string> <string name=mmn1"> how are you diemno</string> <string name=mmn2"> how are you diousk</string> </resources>
38
39
There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace android:id="@android:id/empty"
40
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_x="10px" android:layout_y="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </AbsoluteLayout>
41
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:text="Learn-Android.com" android:textSize="24sp" android:textColor="#000000" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center"/> </FrameLayout>
42
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
43
android:orientation="horizontal"
android:orientation=vertical"
44
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <Button android:id="@+id/backbutton" android:text="Back" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/firstName" android:text="First Name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/backbutton" /> </RelativeLayout>
45
46
Android Application Layer Dalvik Virtual Machine Android Development Environment Android application source layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
47
There are a set of debug tools in android SDK, Tool is located on platform-tool and tools directory.
Android Debug Bridge(ADB)
a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program.
48
49
50
$./adb devices #list detected devices $./adb root #change root Permissions $./adb remount #remount system $./adb kill-server #end adb $./adb forward tcp:x tcp:x #port forward
51
Viewing heap usage for a process Tracking memory allocation of objects Working with an emulator or device's file system Examining thread information Starting method profiling LogCat information
52
logcat
53
54
Android Application Layer Dalvik Virtual Machine Android Development Environment Android Application Layout Android Debug Tools LAB : Program & Run Android apk on devkit8000
55
Lab files
eclipse_linux.tgz
Eclipse IDE with ADT for Linux
android_sdk.tgz
Android SDK
mmn_apk.tgz
Android application to be modified
bitmap: to be processed (already initiated in the code) faces: stored the detected faces (already initiated in the code) Class FaceDetector.Face
float confidence ()
The confidence factor between 0 and 1
float eyesDistance () void getMidPoint (PointF point) float pose (int euler)
the Euler axis to retrieve an angle from (EULER_X, EULER_Y or EULER_Z)