Introduction
@ME (About) Marcelo Cyreno Skype: marcelocyreno Linkedin: marcelocyreno Mail: marcelocyreno@gmail.com
Android - Highlights Open Source Linux Based Developed by Google / Open Handset Alliance Leading Smartphone Platform Java Language* Smartphones, Tablets, TVs (Usage) Samsung, Motorola, LG, HTC, Sony... (Vendors)
History / Events 2003 - Android, Inc. (Foundation) 2005 - Google acquisition 2006 - Schmidt was elected to Apple's board of directors. 2007 - Open Handset Alliance 2007 - First iphone released 2008 First Android Device (Oct.) 2009 - Schmidt "left" Apple's board of directors. 2011 - Google Inc. had agreed to acquire Motorola Mobility. 2012 - Apple wins patent ruling over Samsung (1B USD)
Major Mobile Platforms Windows Phone Android ios
Cross Platform Development RhoMobile (By Motorola) Appcelerator PhoneGap (Adobe) HTML5
Cross Platform - Fractions App http://www.mafua.com
Cross Platform - Fractions App http://www.mafua.com
First Android (HTC Dream)
Latest Android - LG Optimus G
Latest Android - LG Optimus G
Android HW Evolution HTC Dream x LG Optimus G Spec. comparation (Next Slide) X http://www.gsmarena.com/compare.php3?idphone1=2665&idphone2=4941
Latest Android (LG Optimus G) #3
Market Share (Global)
Market Share (Brazil)
Android Versions Code name (no code name) (no code name) Cupcake Donut Eclair Eclair Eclair Froyo Gingerbread Gingerbread Honeycomb Honeycomb Honeycomb Ice Cream Sandwich Ice Cream Sandwich Jelly Bean Version 1.0 1.1 1.5 1.6 2.0 2.0.1 2.1 2.2.x 2.3-2.3.2 2.3.3-2.3.7 3.0 3.1 3.2.x 4.0.1-4.0.2 4.0.3-4.0.4 4.1.x API level API level 1 API level 2 API level 3, NDK 1 API level 4, NDK 2 API level 5 API level 6 API level 7, NDK 3 API level 8, NDK 4 API level 9, NDK 5 API level 10 API level 11 API level 12, NDK 6 API level 13 API level 14, NDK 7 API level 15, NDK 8 1.2%
Android Distribution Version Distribution (September 4, 2012) 4.1.x Jelly Bean 1.2% 20.9% 4.0.x Ice Cream Sandwich 3.x.x Honeycomb 2.3.x Gingerbread 2.2 Froyo 2.0, 2.1 Eclair 1.6 Donut 1.5 Cupcake 2.1% 57.5% 14% 3.7% 0.4% 0.2%
Android Architecture
Development Environment Java SE Development Kit (JDK) Eclipse ADT Plugin Android SDK
Environment - Eclipse http://www.eclipse.org/downloads/
Android Developer (Site) http://developer.android.com/index.html
Android SDK
Android ADT https://dl-ssl.google.com/android/eclipse/
Eclipse - ADT
Eclipse - ADT
Eclipse - ADT
Eclipse - Android SDK
Eclipse - Android SDK Manager
Android Virtual Device (AVD)
Eclipse - DDMS
Eclipse - DDMS (Screen Capture)
Application Directory Structure AndroidManifest.xml src/ res/ drawable/ layout/ values/
AndroidManifest.xml - Example
Activities
Activity Lifecycle Resumed Paused Stopped
Activity Lifecycle
Intents Explicit intents Implicit intents With Data With result
Intents - Explicit 1) (Same Package) Intent intent = new Intent(this, SecondActivity.class); startactivity(intent); 2)(Different Package) Intent intent = new Intent(); intent.setclassname("com.example.intents", "com.example.intents.secondactivity"); startactivity(intent);
Intents - Implicit #1 1) Uri webpage = Uri.parse("http://www.android.com"); Intent intent = new Intent(Intent.ACTION_VIEW, webpage); startactivity(intent); 2) Uri number = Uri.parse("tel:5551234"); Intent intent = new Intent(Intent.ACTION_DIAL, number); startactivity(intent);
Intents - Implicit #1 3) Uri uri = Uri.parse( "geo:0,0?q=1600+amphitheatre+parkway, +Mountain+View,+California"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startactivity(intent);
Intents - With Data #1 1) MainActivity Intent intent = new Intent(this, SecondActivity.class); intent.putextra(secondactivity.message, message); startactivity(intent);
Intents - With Data #2 @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_second); String message = getintent().getstringextra(message); if (message!= null && message.length() > 0) { Toast.makeText(this, "MESSAGE: " + message, Toast.LENGTH_LONG).show(); } }
Intents - With Result #1 // The request code private static final int PICK_CONTACT_REQUEST = 1; private void pickcontact() { Uri uri = Uri.parse("content://contacts"); Intent pickcontactintent = new Intent(Intent.ACTION_PICK, uri); // Show user only contacts w/ phone numbers pickcontactintent.settype(phone.content_type); startactivityforresult(pickcontactintent, PICK_CONTACT_REQUEST); }
Intents - With Result #2 @Override protected void onactivityresult(int requestcode, int resultcode, Intent data) { if (requestcode == PICK_CONTACT_REQUEST && resultcode == RESULT_OK) { Uri contacturi = data.getdata();... Toast.makeText(this, "Contact selected: " + name, Toast.LENGTH_LONG).show(); } }
Layouts Linear Layout Relative Layout List View Grid View
Layout Visual Editor (WYSIWYG)
Linear Layout #1
Linear Layout #2 <LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:layout_width ="fill_parent" android:layout_height ="fill_parent" android:paddingleft ="16dp" android:paddingright ="16dp" android:orientation ="vertical" > <EditText android:layout_width ="fill_parent" android:layout_height ="wrap_content" android:hint ="@string/to" /> <EditText android:layout_width ="fill_parent" android:layout_height ="wrap_content" android:hint ="@string/subject" /> <EditText android:layout_width ="fill_parent" android:layout_height ="0dp" android:layout_weight ="1" android:gravity ="top" android:hint ="@string/message" /> <Button android:layout_width ="100dp" android:layout_height ="wrap_content" android:layout_gravity ="right" android:text ="@string/send" /> </LinearLayout>
Relative Layout #1
Relative Layout #2 <?xml version ="1.0" encoding ="utf-8"?> <RelativeLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:layout_width ="fill_parent" android:layout_height ="fill_parent" android:paddingleft ="16dp" android:paddingright ="16dp" > <EditText android:id ="@+id/name" android:layout_width ="fill_parent" android:layout_height ="wrap_content" android:hint ="@string/reminder" /> <Spinner android:id ="@+id/dates" android:layout_width ="0dp" android:layout_height ="wrap_content" android:layout_below="@id/name" android:layout_alignparentleft="true" android:layout_toleftof="@+id/times" /> <Spinner android:id ="@id/times" android:layout_width ="96dp" android:layout_height ="wrap_content" android:layout_below="@id/name" android:layout_alignparentright="true" /> <Button android:layout_width ="96dp" android:layout_height ="wrap_content" android:layout_below="@id/times" android:layout_alignparentright="true" android:text ="@string/done" /> </RelativeLayout>
List View #1
List View #2
List View #3
List View #4
Grid View
Grid View <?xml version ="1.0" encoding ="utf-8"?> <GridView xmlns:android ="http://schemas.android.com/apk/res/android" android:id ="@+id/gridview" android:layout_width ="fill_parent" android:layout_height ="fill_parent" android:columnwidth ="90dp" android:numcolumns ="auto_fit" android:verticalspacing ="10dp" android:horizontalspacing ="10dp" android:stretchmode ="columnwidth" android:gravity ="center" />
Grid View #3
Grid View #4
Fragments
Localization #1
Localization #2
Google Play Numbers: + 600,000 apps + 20 billions downloads + 400 millions devices
Jobs Opportunities
Questions?