Android … Developer Intro


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Android … Developer Intro

  1. 1. Android Developer Introduction Eric Faccer Tricorder
  2. 2. Presentation Overview • Dream/ADP1 Handset Overview • The Android SDK • The Android Software Stack • Advanced Concepts • Web Resources
  3. 3. HTC Dream • Qualcomm ARM based CPU • Camera • Accelerometer • GPS, Digital Compass • WIFI, Bluetooth • TouchScreen • 3D Graphics
  4. 4. Other Devices • Openmoko FreeRunner • Motorola A1200 Ming • HTC Vogue • HTC Touch • Nokia N810 • Nokia 770 • Asus EEEPC 701 • Asus EEEPC 1000H • Always Innovating Touch Book • Dell Axim x51v
  5. 5. Open Handset Alliance • Mobile Phone Consortium dedicated to open standards for mobile devices. • Google, HTC, Intel, Samsung, Motorola, Qualcomm, T-Mobile, Sprint Nextel, Nvidia, Sony Ericsson, Vodaphone, ARM Holdings, Asustek, Toshiba, Garmin. • Nokia has hedged their bets and reportedly has a large team working on android.
  6. 6. What is Android • Custom Linux Distribution and Java-based Virtual Machine • Based on the Java language 1.5 standard • Java is an overloaded term. It refers to: – A language with a distinct syntax/grammar – A class library – A stack based virtual machine • Android has implemented their own VM called Dalvik. Dalvik is different because it uses a register based VM architecture. • The practical consequence of the decision to drop the Java VM is standard java classes cannot be used on android without conversion.
  7. 7. What is Android
  8. 8. SDK Demo & Tools Overview • Eclipse Plugin • DDMS • HierarchyViewer • Activitycreator • Aapt Tool • Dx
  9. 9. Activity class • Roughly corresponds to a single “screen” • Your application’s entry point. • Does not require a user interface, but that would be atypical. • When a new screen opens, the previous screen is paused and put onto a history stack. The user can then navigate backwards through previously opened screens in the history. Screens can also be removed from the history stack when it would be inappropriate for them to remain.
  10. 10. Service class • Application component that runs in the background, for an indefinite period of time. • OpenBinder – System Level IPC and Component Framework • Local Services and Remote Services • Remote Services require using aidl and Parcelable classes
  11. 11. Activity or Service Blocking • Use Threads liberally. • If your application or service blocks, the ActivityManager will come over and throw up a nasty ANR error for Application Not Responding. • If you start getting these, you know what to do.
  12. 12. AndroidManifest.xml • A means for publishing application metadata Service Registration: <service android:name= "" /> Permissions: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> Intent-Filters: <intent-filter> <action android:name=""/> <action android:name=""/> </intent-filter>
  13. 13. Intent class • An intent is a description of an operation to be performed. • It can be used with Activity.startActivity() to launch an Activity or Context.BindService() to communicate with a Service. It can be broadcast system-wide to send it to any interested BroadcastReceiver components
  14. 14. Intent Example Intent myIntent = new Intent( android.content.Intent.ACTION_VIEW, Uri.parse("geo:38.899533,-77.036476") ); startActivity(myIntent); Will open up the Maps Activity with the specified coordinates.
  15. 15. Resources • Android SDK apps have no access to the underlying filesystem (except /sdcard) • Resources are build time artifacts (files) that are included in your application package. res/drawable – for images png/jpg, etc. res/layout – for xml layout files res/menu – for xml based menu specifications res/values – for strings, dimensions, etc. res/anim – for animations res/raw – for raw files
  16. 16. BroadcastReceiver • A means to respond to system level events • The interface consists of a single method: onReceive() { } • To use in your Activity: • registerReceiver() in your Activity’s onResume() callback • unRegisterReceiver() in your Activity’s onPause() method • You can’t use it as an arbitrary message bus, because it will miss messages when the it’s Activity is inactive. • This holds even if you fail to unregister the receiver. Unregistering the receiver is merely good practice that reduces the system overhead by a small amount.
  17. 17. Content Provider • A means for sharing tabular data across applications • It is a class that implements a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider. • Uses sqlite backend for relational data storage
  18. 18. Android User Interface • May be defined using XML files or by writing standard java code • XML Caveats – The XML parser and renderer have a lot of bugs. This crashes eclipse alot. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="" android:orientation="vertical" android:layout_width="fill_parent“ android:layout_height="fill_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content“ android:text="Hello World"/> </LinearLayout> HINT: USE WRAP_CONTENT! WYSIWYG tool at
  19. 19. Layouts • FrameLayout – contains a single object • LinearLayout – aligns all children in a single direction • TableLayout – positions its children into rows and columns • AbsoluteLayout – absolute positioning RelativeLayout – children specify their position relative to the parent view or to each other
  20. 20. Handling UI events • Handle events the standard way: • EventListeners – onClick() • EventHandlers – onTouchEvent(MotionEvent)
  21. 21. Crossing Things Off of Lists Credit: Jeff Sharkey
  22. 22. Further Reading • • • • #android, #android-dev on •
  23. 23. Advanced Concepts • .pdf • •