0% found this document useful (0 votes)
66 views

Computer Science E-76 Building Mobile Applications

The document discusses Android SDK tools and building mobile applications. It covers the SDK and its components like the emulator, platform tools, and platform versions. It also discusses activities and their lifecycle methods. Finally, it discusses creating user interfaces with views and common layouts in Android.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Computer Science E-76 Building Mobile Applications

The document discusses Android SDK tools and building mobile applications. It covers the SDK and its components like the emulator, platform tools, and platform versions. It also discusses activities and their lifecycle methods. Finally, it discusses creating user interfaces with views and common layouts in Android.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Computer Science E-76

Building Mobile Applications

Lecture 3: [Android] The SDK, Activities, and Views


February 13, 2012
Dan Armendariz
[email protected]

http://developer.android.com

Android

SDK and NDK


2

.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

android - Android SDK manager. Create/


delete/view Android Virtual Devices and
update the SDK with new platforms/add-ons.
ddms - Dalvik Debug Monitor Server. Screen
caps, thread/heap info, process/state info, ..

SDK

Tools
6

emulator - The application responsible for


opening AVDs instances.
sqlite3 - manage SQLite databases.

SDK

Tools
7

No support for placing or receiving actual phone calls. You


can simulate phone calls (placed and received) through the
emulator console, however.
No support for USB connections
No support for camera/video capture (input).
No support for device-attached headphones
No support for determining connected state
No support for determining battery charge level and AC
charging state
No support for determining SD card insert/eject
No support for Bluetooth

SDK

Emulator Limitations
8

# adb - Android Debug Bridge. A client/


server program that manages the state of an
emulated device.
# aapt - Android Asset Packaging Tool.
# dx - The converter; converts .class files to
Android bytecode.

SDK

Platform Tools
9

telnet localhost <console-port>


console-port: 5554+2n
where n is the emulator number (0th, 1st, 2nd)
Use commands like:
redir, power, geo, network, gsm, sms

SDK

Emulator Console
10

Data as of 1/3/2012. From: http://developer.android.com/resources/dashboard/platform-versions.html

SDK

Platform Versions
11

Data as of 2/1/2012. From: http://developer.android.com/resources/dashboard/platform-versions.html

SDK

Platform Versions
12

Data collected during 2 weeks in Jul 2010. From: http://developer.android.com/resources/dashboard/screens.html

SDK

Screen Sizes & Densities


13

Data collected over 1 week ending on 2/1/2012. From: http://developer.android.com/resources/dashboard/screens.html

SDK

Screen Sizes & Densities


14

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);
}
}

Code adapted from: http://developer.android.com/resources/tutorials/hello-world.html

Hello, World!
15

public class Activity extends ApplicationContext {


protected void onCreate(Bundle savedInstanceState);
protected void onStart();

protected void onRestart();
protected void onResume();
protected void onPause();
protected void onStop();
protected void onDestroy();
}

http://developer.android.com/reference/android/app/Activity.html

Activity Methods
16

http://developer.android.com/reference/android/app/Activity.html

Activity Lifecycle
17

TextView tv = new TextView(this);


tv.setText("Hello, Android");

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

Computer Science E-76


Building Mobile Applications

Lecture 3: [Android] The SDK, Activities, and Views


February 13, 2012
Dan Armendariz
[email protected]

21

You might also like