android dev

13
Android Dev [email protected]

Upload: yincan-sheng

Post on 28-Jan-2015

119 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 2: Android dev

Android Platform(1)

Page 3: Android dev

Android Platform(2)Linux for device drivers, memory management, process management, networking

Next level up is the android native libs, written in c/c++ internally. Call from java interfaces.

Dalvik VM. Dalvik runs dex files, converted from standard class file at compile time.

Application Framework, for developers

Page 4: Android dev

More about Dalvik

It is optimized for low memory requirements, and is designed to allow multiple VM instances to run at once, relying on the underlying OS for process isolation, MM and thread support.

one app 16m memory

Page 5: Android dev

Dev environmentJava

Android SDKs + source code

libs,

dev tools: dx, aapt, adb, ddms, ant scripts

Simulators, docs, sample codes

Eclipse + ADT (optional)

Page 6: Android dev

android-project

Page 7: Android dev

Application Fundamentals

Activities/Services/Content Providers/Broadcast receivers

Intent(async messaging bundle)

Manifest File

layouts

resources

Page 8: Android dev

Activity

Associate with layout-view

In stack(could be multiple instances)

Lifecycle

UI(Main) thread/Other threads:

Don’t block the UI thread

Do not access the android ui toolkit from outside the UI thread

AsyncTask

Page 9: Android dev

intent-example-oauth1. <activity android:name=".ArticleActivity">

<intent-filter> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:scheme="mashableoauth" android:host="twitt"></data> </intent-filter>

</activity>

2. ArticleActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL()))); 3. protected void onNewIntent(Intent intent) { Uri uri = intent.getData();

if (uri != null && uri.toString().startsWith(CALLBACK_URL)) {

....

}

Page 10: Android dev

Layout/ViewTwo kinds of UI elements, one is layout(manager), the other is View

SDK provides lots of layouts

SDK provides lots of views, like list-view, button, text-view, image-view, progress dialog....

custom-view steps(measure then layout)

direct use the canvas to draw the view

Page 11: Android dev

Resourcesdrawable assets, (png, xml)

strings

styles

UI patterns (http://www.google.com/events/io/2010/sessions/android-ui-design-patterns.html)

Page 12: Android dev

Performance Tips

Caching (weak reference)

Improve ListView (http://www.google.com/events/io/2010/sessions/world-of-listview-android.html)

Other tips

http://www.google.com/events/io/2010/sessions/beginners-guide-android.html

devguide(http://developer.android.com/guide/practices/design/performance.html)

Page 13: Android dev

your own app/game?Publishing, no app review on android-market

User experience is the most important thing

UI/Navigation

You have 5 seconds for user operations to finish, but 100-200ms, user feels the lag

widgets, notifications, services