SlideShare a Scribd company logo
1 of 79
Getting started with  Gunjan Kumar
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
OVERVIEW OF ANDROID
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://en.wikipedia.org/wiki/Android_%28operating_system%29
History ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Version history http://en.wikipedia.org/wiki/Android_version_history Version Name Release Date Beta 5 November 2007 1.0 23 September 2008 Android Market, Google account integration, maps … 1.1 9 February 2009 resolved issues, API changes … 1.5 Cupcake 30 April 2009 Widgets, upload to YouTube and Picasa … 1.6 Donut 15 September 2009 WVGA / CDMA support, Google navigation, Search enhancement … 2.0/2.1 Éclair 26 October 2009 / 12 January 2010 Live wallpaper, multiple screen resolutions, Camera flash … 2.2 Froyo 20 May 2010 Chrome’s V8 JavaScript engine, upload file in browser … 2.3 Gingerbread 6 December 2010 Voice and Video support in Gtalk … 3.0 / 3.1 Honeycomb 22 February 2011 / 10 May 2011 Released for tablets Ice Cream Sandwich Q4 2011 combination of Gingerbread and Honeycomb into a "cohesive whole"
Usage share / Market Share Source Year Symbian Android RIM iOS Microsoft Other OSs Gartner 2011 Q1 27.4% 36.0% 12.9% 16.8% 3.6% 3.3% Gartner 2010 37.6% 22.7% 16.0% 15.7% 4.2% 3.8% Gartner 2009 46.9% 3.9% 19.9% 14.4% 8.7% 6.1% Gartner 2008 52.4% 0.5% 16.6% 8.2% 11.8% 10.5% Gartner 2007 63.5% N/A 9.6% 2.7% 12.0% 12.1%
Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/basics/what-is-android.html
Android architecture http://developer.android.com/images/system-architecture.jpg
SETUP FOR DEVELOPMENT
App development overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
App development : options ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 1 : Install SDK ,[object Object],[object Object],[object Object],[object Object],http://developer.android.com/sdk/installing.html
Step 1 : Install SDK- tips ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 2 : Eclipse plug-in – Why? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 2 : Eclipse plug-in : How? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ANDROID VIRTUAL DEVICE
Development in Eclipse
Create AVD and launch Emulator (command line) ,[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/managing-avds-cmdline.html http://developer.android.com/guide/developing/tools/emulator.html
Create AVD from SDK Manager
Create AVD from Eclipse
Specifying details for AVD SD Card must be at least 9MB or left blank Skin allows to choose resolution / form factor for the device you want to emulate Name the device and select the target (the version of Platform that you want to emulate. Note that the list will be pulled out from the list of platforms you have installed on your machine (you can see in <sdk>platforms folder)
Emulator
DEVELOPING ANDROID APPLICATIONS
Activities ,[object Object],[object Object],[object Object],[object Object],[object Object]
Services ,[object Object],[object Object],[object Object]
Intent ,[object Object],[object Object],[object Object],[object Object],[object Object],Intent browserIntent = new Intent(Intent. ACTION_VIEW, Uri.parse(URL));  startActivity(browserIntent);  Intent callIntent = new Intent(Intent. ACTION_CALL); callIntent.setData(Uri. parse(&quot;tel:&quot; + PhoneNumber)); startActivity(callIntent); void OpenHome(){ Intent myIntent = new Intent(QwestAvailabilityDetails.this, QwestHome.class); startActivity(myIntent); }
Content Provider ,[object Object],[object Object]
Create new app Specify the project name as it should appear in your workspace Specify the target platform – depending on the device you are expecting this to run on Application Name – as will appear on the device Create Activity – the first activity that will be launched when app starts
What is generated? Named as the Create Activity specified when creating the app, this extends android.app.Activity and serves as the “screen” that is shown to the user Auto generated file. DON’T MANIPULATE. Contains reference to all resources. Used in activities to access the resources Contains resources – layouts, images, values to be used in app – referenced via R Contains the icon which will be used on device for your app. Any more images that you use in the app must be added here. Add versions based on resolution to each of the folders Layouts specify the screens look and feel – think of it as HTML. Typically, you will have one layout for each activity. Main.xml is generated by default to correspond to the initial activity created by default Gives details like package, activity to be launched when app starts, permissions and intents – app configuration file of sorts Contains values specified as type, name and value. Can be of types other than string (say colors) Gives flexibility of configuring based on environment – one set for each environment Contains all the source code
AndroidManifest.xml ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/manifest/manifest-intro.html
UI concepts : View ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UI Concepts : View ,[object Object],View mainPanel = CreateView(); setContentView(R.layout. materpage);  TableLayout tlContainer = (TableLayout) findViewById(R.id. containerForIndividualLayout); tlContainer.addView(mainPanel); private ViewGroup CreateView()  { LinearLayout panel = new LinearLayout(this); panel.setLayoutParams(new LayoutParams(LayoutParams. FILL_PARENT, LayoutParams.FILL_PARENT)); panel.setOrientation(LinearLayout. VERTICAL); panel.setPadding(10, 0,0,0); panel.setBackgroundColor(Color. TRANSPARENT); TextView txtHeader = new TextView(getApplicationContext()); txtHeader.setText(&quot;Congratulations! You qualify for the following products.&quot;); txtHeader.setTextSize(20);
UI Concepts : Layout  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UI Concepts: Widgets and events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/ui/ui-events.html
UI Concepts: Options Menu ,[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/ui/menus.html
UI Concepts: Options Menu http://developer.android.com/guide/topics/ui/menus.html @Override public boolean onCreateOptionsMenu(Menu menu) {  MenuInflater inflater = getMenuInflater();  inflater.inflate(R.menu. main_menu, menu);  return true; } ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],resource main_menu is defined with items like :  <item android:id= &quot;@+id/menu_item_alerts&quot;  android:icon= &quot;@drawable/icon_menu_alert&quot;  android:title= &quot;Alerts Demo&quot; />
UI Concepts: Context Menu ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UI Concepts: Context Menu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {  super.onCreateContextMenu(menu, v, menuInfo);  MenuInflater inflater = getMenuInflater();  inflater.inflate(R.menu. context_menu, menu); } @Override public boolean onContextItemSelected(MenuItem item) {  AdapterContextMenuInfo  info = (AdapterContextMenuInfo) item.getMenuInfo();  switch (item.getItemId()) {  case R.id. ctx_menu_item_option_1:  showToast(&quot;context menu option 1 selected&quot;, getApplicationContext()); return true; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState  setContentView(R.layout.alert); txtAlertName = (EditText)findViewById(R.id.txtAlertName); registerForContextMenu(txtAlertName);
UI Concepts: Alerts / Dialogs Toast AlertDialog ProgressDialog DatePickerDialog TimePickerDialog
UI Concepts: Alerts / Dialogs int duration = Toast. LENGTH_SHORT; Toast toast = Toast. makeText(appContext, message, duration); toast.show(); TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { //TODO : When user selects time }}; TimePickerDialog timePicker = new TimePickerDialog(this,  mTimeSetListener, mHour, mMinute, true); timePicker.show(); DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { //TODO : when user selects Date }}; DatePickerDialog datePicker = new DatePickerDialog(this,  mDateSetListener,  cyear, cmonth, cday); datePicker.show(); Toast DatePickerDialog TimePickerDialog
UI Concepts: Alerts / Dialogs ProgressDialog dialog = new ProgressDialog( DemoAlerts.this); dialog.setMessage(&quot;This is the content you want to show - like please wait while we fetch your account details...&quot;); dialog.setProgressStyle(ProgressDialog. STYLE_SPINNER); // dialog.setProgressStyle(ProgressDialog. STYLE_HORIZONTAL);// this gives progress bar dialog.show(); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(&quot;This is the title for the window&quot;); alertDialog.setMessage(&quot;The dialog message goes here. This can be any text and as per the length, it will wrap this.&quot;); alertDialog.setButton(&quot;Btn1&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setButton2(&quot;Btn2&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setButton3(&quot;Btn3&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setIcon(R.drawable. icon); alertDialog.show(); ProgressDialog AlertDialog
UI Concepts: Status Bar Notification ,[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/ui/notifiers/notifications.html
SESSION 2 : Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sensors ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/reference/android/hardware/SensorManager.html
Sensors Example - orientation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/reference/android/hardware/SensorManager.html @Override public void onResume() / onPause() { super.onResume(); sensorManager.registerListener / unregisterListener (this,  sensorToListenFor); } public void onSensorChanged(int sensor, float[] values) { if(sensor ==  sensorToListenFor) { float azimuth = Math. round(values[0]); float pitch = Math. round(values[1]); float roll = Math. round(values[2]);
Sensors Example - orientation values[0]: Azimuth, angle between the magnetic north direction and the y-axis, around the z-axis (0 to 359). 0=North, 90=East, 180=South, 270=West  values[1]: Pitch, rotation around x-axis (-180 to 180), with positive values when the z-axis moves toward the y-axis.  values[2]: Roll, rotation around y-axis (-90 to 90), with positive values when the x-axis moves toward the z-axis.
Sensors - testing ,[object Object],[object Object],[object Object]
Sensor testing : snapshots from phone Azimuth around 0 – phone is pointing in the North direction Azimuth around 90 – phone is pointing in the East direction Azimuth around 180 – phone is pointing in the South direction Azimuth around 270 – phone is pointing in the West direction Pitch around 0 – phone is “lying flat” Pitch around -90 – phone is “standing”  Pitch around 90 – phone is “standing on its head” Roll around 0 – phone is “lying flat” Roll around -90 – phone is  “standing on its side”
Location Based Services ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/location/obtaining-user-location.html
Location Listener and Manager ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://www.devx.com/wireless/Article/39239/1954
Location : Testing ,[object Object],[object Object],[object Object],[object Object]
Location : Testing : Sending location from console ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/emulator.html
Geocoding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://code.google.com/apis/maps/documentation/geocoding/index.html
Geocoding support in Android ,[object Object],[object Object],try { List<Address> addresses = geocoder.getFromLocation(location.getLatitude(),location.getLongitude(), 10); for(Address currentAddress : addresses) { lblShowLocation.append(&quot;&quot; + currentAddress.getAddressLine(0)); } }  catch (IOException e) {e.printStackTrace(); } http://developer.android.com/reference/android/location/Geocoder.html try { List<Address> locations= geocoder.getFromLocationName(“1600 Glenarm Place, Denver, CO”, 10); for(Address currentLocation: locations) { lblShowLocation.append(&quot;&quot; + currentLocation .getLatitude()); } }  catch (IOException e) {e.printStackTrace(); }
Maps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/tutorials/views/hello-mapview.html
Maps : register API key ,[object Object],[object Object],[object Object],[object Object],[object Object],C:gt;keytool -list -alias androiddebugkey -keystore &quot;C:ocuments and Settingsxkumarandroidebug.keystore&quot; -storepass android -keypass android androiddebugkey, Jun 22, 2011, PrivateKeyEntry, Certificate fingerprint (MD5):  32:E4:29:6C:2B:98:9C:33:41:5F:7F:43:CA:04:C7:33 http://code.google.com/android/add-ons/google-apis/mapkey.html
Maps : how to show map? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/tutorials/views/hello-mapview.html
Maps : respond to location update To add zoom controls: mapView = (MapView)findViewById(R.id. mapview); mapView.setBuiltInZoomControls(true);  To show the location on map In the onCreate method  : MapController mc = mapView.getController(); In listener :  public void onLocationChanged(Location loc) { … … GeoPoint p = new GeoPoint( (int) (loc.getLatitude() * 1E6),  (int) (loc.getLongitude() * 1E6)); mc.animateTo(p); mc.setZoom(13); To set view of map mapView.setSatellite(true); mapView.setStreetView(true); http://mobiforge.com/developing/story/using-google-maps-android
Maps : overlays ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Maps : add marker Add Markers //get the overlays and clear it List<Overlay> mapOverlays = mapView.getOverlays(); mapOverlays.clear(); //first we need to define the  drawable using one of the icons Drawable drawable = this.getResources().getDrawable(R.drawable. icon_map_marker); //initialize the itemized overlay using the current marker CustomItemizedOverlay mapOverlay = new CustomItemizedOverlay(drawable); GeoPoint point = new GeoPoint((int) (( loc.getLatitude())  * 1E6), (int) ((loc.getLongitude())  * 1E6)); OverlayItem overlayitem = new OverlayItem(point, &quot;title&quot;, &quot;snippet&quot;); mapOverlay.addOverlay(overlayitem);  mapOverlays.add(mapOverlay);  mapView.invalidate(); class CustomItemizedOverlay extends ItemizedOverlay
Maps : keep adding markers public void AddLocationToMap(Location loc) {  //get the overlays and clear it List<Overlay> mapOverlays = mapView.getOverlays(); mapOverlays.clear();  GeoPoint point = new GeoPoint((int) (( loc.getLatitude())  * 1E6),  (int) ((loc.getLongitude())  * 1E6)); String addressForPoint =  &quot;&quot;; addressForPoint = GetAddressFromPoint(point, getApplicationContext()); lblAddress.setText(addressForPoint); //create an overlay items OverlayItem overlayitem = new OverlayItem(point, &quot;Address : &quot;  + addressForPoint, &quot;snippet&quot;); //add it to the our customized overlay item list itemizedOverlay.addOverlay(overlayitem);  //add the current list to mapOverlays mapOverlays.add(itemizedOverlay);  //invalidate will force to redraw the map mapView.invalidate(); }
Caution while listening for location change ,[object Object],[object Object],[object Object],[object Object],[object Object]
Maps : sample app for tracking your path ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
INSTALL / TEST ON AVD
Installing and running the app ,[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/emulator.html
Install APK to AVD ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://www.android.pk/blog/general/how-to-install-apk-files-on-android-emulator/
Console ,[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/emulator.html
Example : Sending geocode from console ,[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/emulator.html
Available console commands
IDEAS FOR TESTING
Mobile testing types ,[object Object],[object Object],[object Object],[object Object],[object Object],http://c0954852.cdn.cloudfiles.rackspacecloud.com/uTest_eBook_Mobile_Testing.pdf
Mobile testing methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ideas for Testing ,[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/developing/devices/managing-avds-cmdline.html
Ideas for testing ,[object Object],[object Object],[object Object],[object Object],[object Object],http://developer.android.com/guide/topics/testing/what_to_test.html
Ideas for testing ,[object Object],[object Object],[object Object]
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Q and A ?
[object Object],[object Object],[object Object]

More Related Content

What's hot

Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studioFarabi Technology Middle East
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android developmentGhufran Hashmi
 
Android Development: Build Android App from Scratch
Android Development: Build Android App from ScratchAndroid Development: Build Android App from Scratch
Android Development: Build Android App from ScratchTaufan Erfiyanto
 
Android Fundamentals
Android FundamentalsAndroid Fundamentals
Android FundamentalsHenry Osborne
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginnerAjailal Parackal
 
Android Studio Overview
Android Studio OverviewAndroid Studio Overview
Android Studio OverviewSalim Hosen
 
9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)Peter Mburu
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialEd Zel
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialkatayoon_bz
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialmaster760
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_startedAhsanul Karim
 
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Opersys inc.
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!Édipo Souza
 

What's hot (20)

Android development session 5 - Debug android studio
Android development   session 5 - Debug android studioAndroid development   session 5 - Debug android studio
Android development session 5 - Debug android studio
 
Getting Enter in Android development
Getting Enter in Android developmentGetting Enter in Android development
Getting Enter in Android development
 
Android Development: Build Android App from Scratch
Android Development: Build Android App from ScratchAndroid Development: Build Android App from Scratch
Android Development: Build Android App from Scratch
 
Android Fundamentals
Android FundamentalsAndroid Fundamentals
Android Fundamentals
 
Android development module
Android development moduleAndroid development module
Android development module
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
 
Android Studio Overview
Android Studio OverviewAndroid Studio Overview
Android Studio Overview
 
9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)9780134433646 annuzzi ch02 (1)
9780134433646 annuzzi ch02 (1)
 
Android
AndroidAndroid
Android
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android cours
Android coursAndroid cours
Android cours
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Day1 before getting_started
Day1 before getting_startedDay1 before getting_started
Day1 before getting_started
 
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
 
Next Step, Android Studio!
Next Step, Android Studio!Next Step, Android Studio!
Next Step, Android Studio!
 
Android studio
Android studioAndroid studio
Android studio
 

Similar to Getting started with android dev and test perspective

Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to androidzeelpatel0504
 
Android deep dive
Android deep diveAndroid deep dive
Android deep diveAnuSahniNCI
 
1 introduction of android
1 introduction of android1 introduction of android
1 introduction of androidakila_mano
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorialilias ahmed
 
Getting Started with Android 1.5
Getting Started with Android 1.5Getting Started with Android 1.5
Getting Started with Android 1.5Gaurav Kohli
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial pptRehna Renu
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assARVIND SARDAR
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKGun Lee
 

Similar to Getting started with android dev and test perspective (20)

Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
 
Android Intro
Android IntroAndroid Intro
Android Intro
 
1 introduction of android
1 introduction of android1 introduction of android
1 introduction of android
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorial
 
Android
AndroidAndroid
Android
 
Getting Started with Android 1.5
Getting Started with Android 1.5Getting Started with Android 1.5
Getting Started with Android 1.5
 
Introduction to Android Environment
Introduction to Android EnvironmentIntroduction to Android Environment
Introduction to Android Environment
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
 
Android
Android Android
Android
 
Android Basic
Android BasicAndroid Basic
Android Basic
 
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
 
Notes Unit2.pptx
Notes Unit2.pptxNotes Unit2.pptx
Notes Unit2.pptx
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDK
 

Recently uploaded

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 

Recently uploaded (20)

ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 

Getting started with android dev and test perspective

  • 1. Getting started with Gunjan Kumar
  • 2.
  • 4.
  • 5.
  • 6. Version history http://en.wikipedia.org/wiki/Android_version_history Version Name Release Date Beta 5 November 2007 1.0 23 September 2008 Android Market, Google account integration, maps … 1.1 9 February 2009 resolved issues, API changes … 1.5 Cupcake 30 April 2009 Widgets, upload to YouTube and Picasa … 1.6 Donut 15 September 2009 WVGA / CDMA support, Google navigation, Search enhancement … 2.0/2.1 Éclair 26 October 2009 / 12 January 2010 Live wallpaper, multiple screen resolutions, Camera flash … 2.2 Froyo 20 May 2010 Chrome’s V8 JavaScript engine, upload file in browser … 2.3 Gingerbread 6 December 2010 Voice and Video support in Gtalk … 3.0 / 3.1 Honeycomb 22 February 2011 / 10 May 2011 Released for tablets Ice Cream Sandwich Q4 2011 combination of Gingerbread and Honeycomb into a &quot;cohesive whole&quot;
  • 7. Usage share / Market Share Source Year Symbian Android RIM iOS Microsoft Other OSs Gartner 2011 Q1 27.4% 36.0% 12.9% 16.8% 3.6% 3.3% Gartner 2010 37.6% 22.7% 16.0% 15.7% 4.2% 3.8% Gartner 2009 46.9% 3.9% 19.9% 14.4% 8.7% 6.1% Gartner 2008 52.4% 0.5% 16.6% 8.2% 11.8% 10.5% Gartner 2007 63.5% N/A 9.6% 2.7% 12.0% 12.1%
  • 8.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 19.
  • 20. Create AVD from SDK Manager
  • 21. Create AVD from Eclipse
  • 22. Specifying details for AVD SD Card must be at least 9MB or left blank Skin allows to choose resolution / form factor for the device you want to emulate Name the device and select the target (the version of Platform that you want to emulate. Note that the list will be pulled out from the list of platforms you have installed on your machine (you can see in <sdk>platforms folder)
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Create new app Specify the project name as it should appear in your workspace Specify the target platform – depending on the device you are expecting this to run on Application Name – as will appear on the device Create Activity – the first activity that will be launched when app starts
  • 30. What is generated? Named as the Create Activity specified when creating the app, this extends android.app.Activity and serves as the “screen” that is shown to the user Auto generated file. DON’T MANIPULATE. Contains reference to all resources. Used in activities to access the resources Contains resources – layouts, images, values to be used in app – referenced via R Contains the icon which will be used on device for your app. Any more images that you use in the app must be added here. Add versions based on resolution to each of the folders Layouts specify the screens look and feel – think of it as HTML. Typically, you will have one layout for each activity. Main.xml is generated by default to correspond to the initial activity created by default Gives details like package, activity to be launched when app starts, permissions and intents – app configuration file of sorts Contains values specified as type, name and value. Can be of types other than string (say colors) Gives flexibility of configuring based on environment – one set for each environment Contains all the source code
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. UI Concepts: Context Menu @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu. context_menu, menu); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id. ctx_menu_item_option_1: showToast(&quot;context menu option 1 selected&quot;, getApplicationContext()); return true; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState setContentView(R.layout.alert); txtAlertName = (EditText)findViewById(R.id.txtAlertName); registerForContextMenu(txtAlertName);
  • 40. UI Concepts: Alerts / Dialogs Toast AlertDialog ProgressDialog DatePickerDialog TimePickerDialog
  • 41. UI Concepts: Alerts / Dialogs int duration = Toast. LENGTH_SHORT; Toast toast = Toast. makeText(appContext, message, duration); toast.show(); TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { //TODO : When user selects time }}; TimePickerDialog timePicker = new TimePickerDialog(this, mTimeSetListener, mHour, mMinute, true); timePicker.show(); DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { //TODO : when user selects Date }}; DatePickerDialog datePicker = new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday); datePicker.show(); Toast DatePickerDialog TimePickerDialog
  • 42. UI Concepts: Alerts / Dialogs ProgressDialog dialog = new ProgressDialog( DemoAlerts.this); dialog.setMessage(&quot;This is the content you want to show - like please wait while we fetch your account details...&quot;); dialog.setProgressStyle(ProgressDialog. STYLE_SPINNER); // dialog.setProgressStyle(ProgressDialog. STYLE_HORIZONTAL);// this gives progress bar dialog.show(); AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(&quot;This is the title for the window&quot;); alertDialog.setMessage(&quot;The dialog message goes here. This can be any text and as per the length, it will wrap this.&quot;); alertDialog.setButton(&quot;Btn1&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setButton2(&quot;Btn2&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setButton3(&quot;Btn3&quot;, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {//TODO on button click } }); alertDialog.setIcon(R.drawable. icon); alertDialog.show(); ProgressDialog AlertDialog
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. Sensors Example - orientation values[0]: Azimuth, angle between the magnetic north direction and the y-axis, around the z-axis (0 to 359). 0=North, 90=East, 180=South, 270=West values[1]: Pitch, rotation around x-axis (-180 to 180), with positive values when the z-axis moves toward the y-axis. values[2]: Roll, rotation around y-axis (-90 to 90), with positive values when the x-axis moves toward the z-axis.
  • 48.
  • 49. Sensor testing : snapshots from phone Azimuth around 0 – phone is pointing in the North direction Azimuth around 90 – phone is pointing in the East direction Azimuth around 180 – phone is pointing in the South direction Azimuth around 270 – phone is pointing in the West direction Pitch around 0 – phone is “lying flat” Pitch around -90 – phone is “standing” Pitch around 90 – phone is “standing on its head” Roll around 0 – phone is “lying flat” Roll around -90 – phone is “standing on its side”
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59. Maps : respond to location update To add zoom controls: mapView = (MapView)findViewById(R.id. mapview); mapView.setBuiltInZoomControls(true); To show the location on map In the onCreate method : MapController mc = mapView.getController(); In listener : public void onLocationChanged(Location loc) { … … GeoPoint p = new GeoPoint( (int) (loc.getLatitude() * 1E6), (int) (loc.getLongitude() * 1E6)); mc.animateTo(p); mc.setZoom(13); To set view of map mapView.setSatellite(true); mapView.setStreetView(true); http://mobiforge.com/developing/story/using-google-maps-android
  • 60.
  • 61. Maps : add marker Add Markers //get the overlays and clear it List<Overlay> mapOverlays = mapView.getOverlays(); mapOverlays.clear(); //first we need to define the drawable using one of the icons Drawable drawable = this.getResources().getDrawable(R.drawable. icon_map_marker); //initialize the itemized overlay using the current marker CustomItemizedOverlay mapOverlay = new CustomItemizedOverlay(drawable); GeoPoint point = new GeoPoint((int) (( loc.getLatitude()) * 1E6), (int) ((loc.getLongitude()) * 1E6)); OverlayItem overlayitem = new OverlayItem(point, &quot;title&quot;, &quot;snippet&quot;); mapOverlay.addOverlay(overlayitem); mapOverlays.add(mapOverlay); mapView.invalidate(); class CustomItemizedOverlay extends ItemizedOverlay
  • 62. Maps : keep adding markers public void AddLocationToMap(Location loc) { //get the overlays and clear it List<Overlay> mapOverlays = mapView.getOverlays(); mapOverlays.clear(); GeoPoint point = new GeoPoint((int) (( loc.getLatitude()) * 1E6), (int) ((loc.getLongitude()) * 1E6)); String addressForPoint = &quot;&quot;; addressForPoint = GetAddressFromPoint(point, getApplicationContext()); lblAddress.setText(addressForPoint); //create an overlay items OverlayItem overlayitem = new OverlayItem(point, &quot;Address : &quot; + addressForPoint, &quot;snippet&quot;); //add it to the our customized overlay item list itemizedOverlay.addOverlay(overlayitem); //add the current list to mapOverlays mapOverlays.add(itemizedOverlay); //invalidate will force to redraw the map mapView.invalidate(); }
  • 63.
  • 64.
  • 65. INSTALL / TEST ON AVD
  • 66.
  • 67.
  • 68.
  • 69.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78. Q and A ?
  • 79.