Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android TCJUG


Published on

Presentation of Android at the Twin Cities Java User's Group.
Source code at:
Video at:

Published in: Technology
  • Be the first to comment

Android TCJUG

  1. 1. Summary About Me What is Android Anatomy of Android Setting up the environment Let's Code! quot;Contractoidquot; Deploy to the Market
  2. 2. About Me Name: Justin Grammens Owner Localtone Interactive - Focus on mobile, internet and voice applications Support and advocate for open formats (ogg, odf) Background in Java Working in Ruby/Rails/Grails on/off for the past 2 years Enjoy working in new technologies VoIP Asterisk Adhearsion Mobile Android iPhone Started MobileTC -
  3. 3. What is Android? Definition: Android is a software platform and operating system for mobile devices, based on the Linux kernel, developed by Google and later the Open Handset Alliance. Source: Wikipedia It's not just for mobile devices. Has the potential to be used in all sorts of other areas where memory, cpu and disk is limited.
  4. 4. != Android is NOT the G1!
  5. 5. What is Android? A Project of the Open Handset Alliance (OHA) - More than 30 technology companies Source: Presentation by Sean Sullivan -
  6. 6. Anatomy of Android Built on the Linux kernel Uses the Dalvik virtual machine Register Based VM written by Dan Bornstein Very low memory footprint Core and 3rd party applications have equal access Multiple applications able to run at the same time Copy and Paste functionality Background services Able to embed HTML, Javascript and stylesheets 100% fully customizable Handles native and streaming playback of mutimedia Currently supports developing apps in Java
  7. 7. What's the big deal? Truly open and FREE development platform. No quot;pay to playquot; developer agreement. Freely available tools (Eclipse) and no restrictions on OS you need to be on to develop. Component based architecture that can be extended Built in services out of the box. Location based (Gmail, Maps, Contacts) Multimedia - supports OGG! SQLite Database. Automatic management of application lifecycle. Portability across current and future hardware. Supports and plans for input from either trackball, keyboard or touch. Write your apps using Java!
  8. 8. Anatomy of Android
  9. 9. Anatomy of Android Basic foundation of an Android application Activity Intent Service Content Provider Your applications will not use all of these, but they will use atleast one.
  10. 10. Anatomy of Android Activity Describes a single screen of the application Implemented as a class that extends Activity Activities are pushed on the history stack using an Intent Uses callbacks to trigger events during state changes. public class LocaltoneAndroid extends ListActivity { @Override public void onCreate(Bundle init) { } }
  11. 11. Anatomy of Android Activity Lifecycle source: Hello, Android by Pragmatic Programmers
  12. 12. Anatomy of Android Intent An Intent describes what you would like to have done. Create new screen using activity and intents Intent i = new Intent(this, MyNewActivity.class); startActivity(i); or open a web page new Intent(android.content.Intent.VIEW_ACTION, ContentURI.create(quot;http://localtone.comquot;));
  13. 13. Anatomy of Android Service Code that is long running Runs without a UI Media Player is an good example Activity used to choose song Playback handled in a service public class MyService extends Service { public void onCreate() { } }
  14. 14. Anatomy of Android Content Provider Set of data wrapped in a custom API Allow sharing of data between applications Processes register themselves as a Content Provider. Anyone can share data. Google shares contacts, address, phone, etc. can be accessed by applications. private String[] cols={android.provider.Contacts.PeopleColumns.NAME}; private Cursor cur = managedQuery(android.provider.Contacts.People.CONTENT_URI, cols, null, null);
  15. 15. Anatomy of Android Various types of Layouts - Similar to Java Swing Linear Layout Arranges children in a single row/column. The most common type of layout you'll use. FrameLayout Arranges children so they start at the top left. Used mainly for tabbed views. Relative Layout Arranged in relation to eachother ( element X is above/below element Y for example ). TableLayout Arranged in a cells, like HTML table.
  16. 16. Anatomy of Android XML file layout - About.xml <LinearLayout xmlns:android=quot; com/apk/res/androidquot; android:orientation=quot;verticalquot; android:layout_width=quot;fill_parentquot; android:layout_height=quot;fill_parentquot;> <TextView android:id=quot;@android:id/helloquot; android:layout_width=quot;wrap_contentquot; android:layout_height=quot;wrap_contentquot; android:text=quot;@string/helloquot; /> </LinearLayout>
  17. 17. Anatomy of Android Declarative - In XML Task: Define text in an quot;Aboutquot; screen File: res/layout/about.xml <TextView android:id=quot;@+id/about_contentquot; android:layout_width=quot;wrap_contentquot; android:layout_height=quot;wrap_contentquot; android:text=quot;@string/about_textquot; /> File: protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.about); }
  18. 18. Anatomy of Android Procedural - In Code Create a TextView object, set the text and behavior TextView pressMe = new TextView(context); pressMe.setText(quot;Press Mequot;); addView(mDialogue, new LinearLayout.LayoutParams( FILL_PARENT, WRAP_CONTENT));
  19. 19. Anatomy of Android Android Manifest.xml What is any good Java program without a manifest file? =) Defines the version and package information Defines the permissions required by the application <uses-permission android:name=quot;android. permission.INTERNETquot; /> <activity android:name=quot;.Resultquot; Class name android:label=quot;@string/resultquot; of the Activity android:layout_width=quot;fill_parentquot;> </activity>
  20. 20. Development Environment Develop using Windows, Linux or Mac. Free to develop and deploy to your device. Recommend using to Eclipse IDE and Android Plugin Download IDE and from IDE - Install Android plugin through the Eclipse Plug-in Manager SDK
  21. 21. Android Market
  22. 22. Android Market
  23. 23. Resources Books Hello, Android by Pragmatic Programmers Free PDF by - Sites - Good online forum Google Samples - IRC #Android-Dev Google Groups Android Developers Local Groups! Android Dev MN - Mobile Twin Cities -
  24. 24. Let's Code! Source code of Contractoid at: http://github. com/justingrammens/contract oid/tree/master or at: Video of this presentation at:
  25. 25. Thank you