SlideShare uma empresa Scribd logo
1 de 39
Introduction to  Android Programming 0 to “Hello World” in 60 minutes or less Silicon Valley China Wireless Group  Peter van der Linden [email_address] Android Technology Evangelist Developer Community Technical Services Motorola Mobility
Content ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],These slides are online at:  http://www.slideshare.net   account: pvdl01
Moore’s Law and Mobile Devices ,[object Object],[object Object],[object Object],[object Object],[object Object]
Smart Phone Family Tree PDA  cell phone  smart phone tablet netbook laptop Moore’s Law Moore’s  law Actual Family Tree
My Phone has 802.11 b/g/n Wifi 1 GHz CPU Moore’s Law This is not a toy. This is equivalent to a Windows XP PC  512 MB RAM bluetooth DVD quality video player Music quality audio USB port
My Droid X Phone ALSO has accelerometer Digital compass Moore’s Law Today’s  Windows PCs don’t have these …  HD video capture Voice phone with noise-canceling hw 8 MP camera Orientation sensors GPS receiver
Smart Phone Family Tree smart phone laptop Moore’s Law A more insightful way to think of it! = + more hw
Implications of HW capabilities Moore’s Law ,[object Object],[object Object],[object Object],[object Object],[object Object]
2.  Android Software Checklist ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],The more of these you have,  the easier your learning curve will be
2.  Android Software Checklist ,[object Object],[object Object],That’s enough to get started!
The SDK tool chain 5. Java runtime SE ver 6 4. Eclipse 3.5 3. Eclipse  ADT plug-in 2. Android SDK 1. Android Platform(s) Download  1,2,3, from developer.android.com 4 from Eclipse.org 5 from java.com
One stop shopping for Tools ,[object Object],[object Object],[object Object],[object Object],MOTODEV Studio
Compile time tools Java JRE Eclipse 3.5 Eclipse  ADT plug-in Android SDK ,[object Object],[object Object],[object Object],[object Object]
Runtime Development Tools Eclipse 3.5 Android SDK Android Platform ,[object Object],[object Object],[object Object],[object Object],[object Object],Emu
3.  Ingredients of an App ,[object Object],Java  “ glue” XML, icons Media, data files, etc AndroidManifest.xml describes the app overall, features used, version, etc
[object Object],Ingredients of an App, II
[object Object],Ingredients of an App, III Java  “ glue” code XML, icons, etc Manifest.xml
Ingredients of an App, IV ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
4.  GUI Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Press You can have text in a TextView Another Button
4.  GUI Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],public class MyActivity extends Activity implements OnClickListener {           Button b= (Button) findViewById(R.id.pressme);         b.setOnClickListener(this);      . . .      // Implement the OnClickListener callback      public void onClick(View v) {        // actions when the button is clicked      }  
GUI Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
GUI Basics ,[object Object]
Getting into Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getting into Code, XML 1 ,[object Object],[object Object],<?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <LinearLayout   … some attribute=“value” pairs …  > <TextView  … some attribute=“value” pairs …   /> </LinearLayout>
Getting into Code, XML 2 ,[object Object],[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; android:orientation=&quot;vertical&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;fill_parent”  > <TextView  android:layout_width=&quot;fill_parent&quot;  android:layout_height=&quot;wrap_content&quot;  android:text=&quot;@string/hello”  /> </LinearLayout>
Getting into Code, XML 3 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getting into Code, XML 3 ,[object Object]
Getting into Code, II  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Getting into Code, Activity 1 ,[object Object],[object Object],public class MainActivity extends android.app.Activity { /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);  // glue code! } }
Getting into Code, Activity 2 ,[object Object],[object Object],package com.motorola.hello2; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
Getting into Code, Glue ,[object Object],[object Object],[object Object],[object Object],setContentView(  R.layout.main  );  // says “use layout in file res/layout/main.xml”
Getting into Code, Glue 2 The glue code is generated for you Makes XML names in res folder, visible in Java namespace! Create  an ID name for an XML element with this attribute In Java, get hold  of that XML-declared TextView by:  In XML, get hold  of that XML-declared TextView by: TextView tv = (TextView)  findViewById( R.id.myTV ); <TextView  android:id=&quot;@+id/myTV &quot; <Button  android:layout_below= ”@id/myTV &quot;
Getting into Manifest ,[object Object],< ?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <manifest xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; package= &quot;com.motorola.hello2&quot; android:versionCode= &quot;1&quot; android:versionName= &quot;1.0&quot;> <application android:icon= &quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;> <activity android:name= &quot;.MainActivity&quot; android:label= &quot;@string/app_name&quot;> <intent-filter> <action android:name= &quot;android.intent.action.MAIN&quot; /> <category android:name= &quot;android.intent.category.LAUNCHER&quot; /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion= &quot;8&quot; /> </manifest>
Running your code ,[object Object],[object Object],[object Object],[object Object]
Follow-up ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Q & A Where to find more information: http://developer.motorola.com One stop shopping, with links to many other useful places One stop Tools and SDK download Tools that work for all Android devices from all manufacturers.
Apache 2 license Copyright (c) 2007-2010 by the  Android Open Source Project Licensed under the  Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
[object Object],BSD license
[object Object],BSD license

Mais conteúdo relacionado

Mais procurados

Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Jason Conger
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android StudioSuyash Srijan
 
Android application structure
Android application structureAndroid application structure
Android application structureAlexey Ustenko
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginnerAjailal Parackal
 
Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1NancyMariaAS
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application DevelopmentBenny Skogberg
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
Arduino - Android Workshop Presentation
Arduino - Android Workshop PresentationArduino - Android Workshop Presentation
Arduino - Android Workshop PresentationHem Shrestha
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Javaamaankhan
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App DevelopmentTodd Burgess
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]Sittiphol Phanvilai
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android ProgrammingNikmesoft Ltd
 
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studioAbdul Basit
 
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & ComponentsVijay Rastogi
 

Mais procurados (20)

Ci for Android
Ci for AndroidCi for Android
Ci for Android
 
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
Building your Own Mobile Enterprise Application: It’s Not as Hard as You Migh...
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Android application structure
Android application structureAndroid application structure
Android application structure
 
Android ppt
Android pptAndroid ppt
Android ppt
 
android-tutorial-for-beginner
android-tutorial-for-beginnerandroid-tutorial-for-beginner
android-tutorial-for-beginner
 
Android study jams 1
Android study jams 1Android study jams 1
Android study jams 1
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Android overview
Android overviewAndroid overview
Android overview
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Arduino - Android Workshop Presentation
Arduino - Android Workshop PresentationArduino - Android Workshop Presentation
Arduino - Android Workshop Presentation
 
Android Application Development Using Java
Android Application Development Using JavaAndroid Application Development Using Java
Android Application Development Using Java
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App Development
 
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]What’s new in aNdroid [Google I/O Extended Bangkok 2016]
What’s new in aNdroid [Google I/O Extended Bangkok 2016]
 
[Android] Introduction to Android Programming
[Android] Introduction to Android Programming[Android] Introduction to Android Programming
[Android] Introduction to Android Programming
 
Android overview
Android overviewAndroid overview
Android overview
 
Android Seminar
Android SeminarAndroid Seminar
Android Seminar
 
Introduction_to_android_and_android_studio
Introduction_to_android_and_android_studioIntroduction_to_android_and_android_studio
Introduction_to_android_and_android_studio
 
Introduction to Android, Architecture & Components
Introduction to  Android, Architecture & ComponentsIntroduction to  Android, Architecture & Components
Introduction to Android, Architecture & Components
 

Semelhante a Intro to Android Programming

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011sullis
 
Android presentation
Android presentationAndroid presentation
Android presentationImam Raza
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15sullis
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Lars Vogel
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
1 introduction of android
1 introduction of android1 introduction of android
1 introduction of androidakila_mano
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to androidzeelpatel0504
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011sullis
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_programEyad Almasri
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101Michael Angelo Rivera
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android ApplicationArcadian Learning
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development pptsaitej15
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologiesjerry vasoya
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorialilias ahmed
 

Semelhante a Intro to Android Programming (20)

Android Intro
Android IntroAndroid Intro
Android Intro
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Introduction to Android Environment
Introduction to Android EnvironmentIntroduction to Android Environment
Introduction to Android Environment
 
1 introduction of android
1 introduction of android1 introduction of android
1 introduction of android
 
Android TCJUG
Android TCJUGAndroid TCJUG
Android TCJUG
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android - Open Source Bridge 2011
Android - Open Source Bridge 2011Android - Open Source Bridge 2011
Android - Open Source Bridge 2011
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 
Android app development ppt
Android app development pptAndroid app development ppt
Android app development ppt
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Android development-tutorial
Android development-tutorialAndroid development-tutorial
Android development-tutorial
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 

Mais de Peter van der Linden

Mais de Peter van der Linden (8)

Grand finale
Grand finaleGrand finale
Grand finale
 
Master cardapis v7.2020
Master cardapis v7.2020Master cardapis v7.2020
Master cardapis v7.2020
 
Master pass api
Master pass apiMaster pass api
Master pass api
 
Coding to the MasterCard OpenAPIs
Coding to the MasterCard OpenAPIsCoding to the MasterCard OpenAPIs
Coding to the MasterCard OpenAPIs
 
GDC 2014 talk Haptics Android
GDC 2014 talk  Haptics AndroidGDC 2014 talk  Haptics Android
GDC 2014 talk Haptics Android
 
Code to go Android
Code to go AndroidCode to go Android
Code to go Android
 
Putting real feeling into Android Apps
Putting real feeling into Android AppsPutting real feeling into Android Apps
Putting real feeling into Android Apps
 
Droidcon berlin Apr2013
Droidcon berlin Apr2013Droidcon berlin Apr2013
Droidcon berlin Apr2013
 

Intro to Android Programming

  • 1. Introduction to Android Programming 0 to “Hello World” in 60 minutes or less Silicon Valley China Wireless Group Peter van der Linden [email_address] Android Technology Evangelist Developer Community Technical Services Motorola Mobility
  • 2.
  • 3.
  • 4. Smart Phone Family Tree PDA cell phone smart phone tablet netbook laptop Moore’s Law Moore’s law Actual Family Tree
  • 5. My Phone has 802.11 b/g/n Wifi 1 GHz CPU Moore’s Law This is not a toy. This is equivalent to a Windows XP PC 512 MB RAM bluetooth DVD quality video player Music quality audio USB port
  • 6. My Droid X Phone ALSO has accelerometer Digital compass Moore’s Law Today’s Windows PCs don’t have these … HD video capture Voice phone with noise-canceling hw 8 MP camera Orientation sensors GPS receiver
  • 7. Smart Phone Family Tree smart phone laptop Moore’s Law A more insightful way to think of it! = + more hw
  • 8.
  • 9.
  • 10.
  • 11. The SDK tool chain 5. Java runtime SE ver 6 4. Eclipse 3.5 3. Eclipse ADT plug-in 2. Android SDK 1. Android Platform(s) Download 1,2,3, from developer.android.com 4 from Eclipse.org 5 from java.com
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. Getting into Code, Glue 2 The glue code is generated for you Makes XML names in res folder, visible in Java namespace! Create an ID name for an XML element with this attribute In Java, get hold of that XML-declared TextView by: In XML, get hold of that XML-declared TextView by: TextView tv = (TextView) findViewById( R.id.myTV ); <TextView android:id=&quot;@+id/myTV &quot; <Button android:layout_below= ”@id/myTV &quot;
  • 33.
  • 34.
  • 35.
  • 36. Q & A Where to find more information: http://developer.motorola.com One stop shopping, with links to many other useful places One stop Tools and SDK download Tools that work for all Android devices from all manufacturers.
  • 37. Apache 2 license Copyright (c) 2007-2010 by the Android Open Source Project Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • 38.
  • 39.