Computer Science E-76 Building Mobile Applications
Computer Science E-76 Building Mobile Applications
http://developer.android.com
Android
.java (code)
javac (compiler)
.class (bytecode)
dx (converter)
.dex (Dalvik executable)
zip, aapt, etc. (archiver)
.apk (Android Package)
Building an App
3
.java (code)
Eclipse (IDE)
.apk (Android Package)
Building an App
4
SDK
5
SDK
Tools
6
SDK
Tools
7
SDK
Emulator Limitations
8
SDK
Platform Tools
9
SDK
Emulator Console
10
SDK
Platform Versions
11
SDK
Platform Versions
12
SDK
SDK
package com.android.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, World!");
setContentView(tv);
}
}
Hello, World!
15
http://developer.android.com/reference/android/app/Activity.html
Activity Methods
16
http://developer.android.com/reference/android/app/Activity.html
Activity Lifecycle
17
or
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/hello"/>
http://developer.android.com/resources/tutorials/hello-world.html
Creating a UI
18
http://developer.android.com/guide/topics/ui/index.html
Views
Layouts
19
FrameLayout
Gallery
GridView
LinearLayout
ListView
RelativeLayout
ScrollView
Spinner
SurfaceView
TabHost
TableLayout
ViewFlipper
ViewSwitcher
More: http://developer.android.com/reference/android/widget/package-summary.html
Views
Common Layouts
20
21