SlideShare une entreprise Scribd logo
1  sur  32
Why mobile? 
 smartphones = “new thing” 
 portable, powerful 
Why Android? (over iOS) 
 Linux → Open Source 
 Consumer-driven apps 
 Hardware/software choice 
 Google <3 Devs
Overview 
 Java 
 Eclipse 
 Hello World 
 Activity Cycle 
 Try API Demos 
 Stopwatch Example 
 Logcat/DDMS Debugging 
 Market Publishing and more... 
 Beats and Useful Resource Links
Android Java 
 Linux, but apps in Java 
 Dalvik Virtual Machine – DVM 
 .apk format ← Eclipse 
 Standard java.* packages 
 Custom graphics/UI code 
 NDK – C/C++ for ARM 
(OpenGL ES 2.0, libraries, etc.)
Eclipse 
 FOSS, customizable, industry-standard 
 Android-ready 
Download these (if you haven't already) 
Eclipse Classic 3.6.1 
http://www.eclipse.org/downloads/packages/eclipse-classic-361/Android SDK R8 (get the .zip) 
http://developer.android.com/sdk/index.html 
Java SE Development Kit 6u23 (JDK) 
http://www.oracle.com/technetwork/java/javase/downloads/index.Code Samples used 
http://www.stwing.upenn.edu/~pengp/Files/PennApps/PennApps_
Setup (Live Demo!) 
 Install JDK (run installer) 
 Extract Eclipse (e.g. C:/Android/eclipse) 
 Install Android SDK 
 Extract Android SDK (e.g. 
C:/Android/android-sdk-windows) 
 Run SDK Manager 
 Select packages 
(only need Platform-tools, API 9, document, and samples) 
 Download and wait (long) 
 Virtual Devices > New 
 Name: “TestPhone2.3”, Target: Android 2.3 – API Level 9, 
SD Card Size: 64 MiB 
 Create AVD > Start... > Launch 
 A virtual Android 2.3 phone for testing! Yay o/
Setup (Live Demo! Continued) 
 Install ADT Plugin for Eclipse: 
 http://developer.android.com/sdk/eclipse-adt.html#installing 
 Help > Install New Software.... > Add 
 https://dl-ssl.google.com/android/eclipse/ → “ADT” 
 Select All > Next > Next > Accept Terms > Finish > Restart 
 Windows > Preferences... > Android 
 Browse (find “android-sdk-windows” folder) > Apply > OK 
 Eclipse is now ready for Android development! 
Ready for your Android “Hello World”?
Hello World 
File > New > Project > 
Android > Android 
Project
Hello World 
Add the following lines marked by “// <-----”
Hello World 
Run > Run > Android Application
Hello World Inspection 
Package naming convention? 
Activity, Layout, TextView? 
R, src, res, AndroidManifest?
Activity Cycle 
Activity = methods + 
Layout + Dialogs 
 Layout = Views, 
Buttons, etc. 
App = many 
Activities 
 Task = stack of 
Activities from one 
app 
Also: Services, 
Broadcast 
Receivers, Content 
Providers
API Demos 
 File > New > Projects > Android Project 
Create project from existing source 
(C:Androidandroid-sdk-windows 
samplesandroid-9ApiDemos) 
Right click ApiDemos project > Refresh 
 src > com.examples.android.apis > 
ApiDemosApplication 
Run > Run > Android Application (or Ctrl+F5) 
Explore the demos! 
Ready to try it yourself?
Stopwatch 1 
Hello World, but need time and screen updating 
 FormattedTime.java and RefreshHandler.java 
FormattedTime 
 start() - starts timer, returns “00:00:00” 
 stop() - stops timer, returns time “MM:SS:mm” 
 reset() - resets timer, returns “00:00:00” 
 update() - returns time “MM:SS:mm” 
RefreshHandler 
 start(delay) - starts calling update() every delay ms 
 stop() - stops calling update() 
 update() - override this with your code
Stopwatch A 
Hello World, 
with 
FormattedTime 
and 
RefreshHandler 
But this just 
keeps running, 
what about 
stopping or 
resetting?
Views, Images and Buttons, Oh My! 
Activity.setContextView(layout) 
Graphical layout → XML 
Add in Widgets or more Views 
ViewGroups: 
LinearLayout, TableLayout, 
RelativeLayout, ScrollView, 
ListView, GridView 
Widgets/Content Views: 
TextView, WebView,ImageView 
ImageButton, Button, Checkbox, EditText, RadioButton 
See Android documentation for details and more 
http://developer.android.com/guide/topics/ui/index.html
Stopwatch B 
Buttons for Start, 
Stop, Reset 
Give TextView an id 
for reference 
Good practice: use 
strings.xml 
 onClick → method 
Use GridView or 
other ViewGroups 
for nicer layout
Stopwatch B 
Cross-reference TextView (recast) 
 onClick must be public void foo(View view)
Stopwatch C 
 Lets add unnecessary stuff!
More Common Stuff 
Graphics: http://developer.android.com/ → 
 Static → XML layouts 
 Active → Canvas 
 3D → OpenGL ES 1.x or 2.0 (NDK) 
Audio/Video: 
 Playback → MediaPlayer 
 Recording → MediaRecorder 
Data: 
 Settings → PreferenceActivity & PreferenceManager 
 Storage → External Storage, SQLite 
Network: 
 Connectivity → ConnectivityManager 
 Locations → Uri* 
Interactivity: 
 Multiple activities → Intents 
 Other apps/Content handling → Intent Filters
Debugging! 
Logcat!!! (and DDMS later) 
 Log.v(String tag, String msg) 
Also Log.v, .w, .d, .wtf 
ADB 
 android-sdk-*/platform-tools/adb 
 adb push/pull/install 
 adb shell 
 adb logcat
DDMS (Dalvik Debug Monitor Server) 
Eclipse integrated Android debugger 
Windows > Open Perspective > Other... > 
DDMS 
Select device, select process 
Debug, Update Heap, Update Threads 
Allows inspection of threads, heap, 
allocation, files, etc. 
Also displays Logcat and allows for 
screenshots!
Market and Actual Testing? 
Windows > Android SDK & AVD Manager 
Available packages > Third party Add-ons 
Google Usb Driver and Market Licensing 
On your actual phone: 
MENU > Settings > Applications > 
Development > USB debugging ON 
Plug in, compile and run your Android 
app, select your actual phone (or might 
auto-select)
Publishing on the Market 
http://market.android.com/publish/Home 
http://developer.android.com/guide/publishing/publishing.$25 one-time fee for a developer account 
Make money back via either paid app or 
advertisements (AdMob) 
Compare to iOS's $99/YEAR and content 
filtering/approval-based system 
Need to make sure to check support for 
different screen sizes, Android OS 
(current is 2.3 but lots still run 1.5/1.6), 
etc. in AndroidManifest.xml file
Beats, Advanced Rhythm Game 
Website: http://beatsportable.com 
Try it: http://www.tinyurl.com/beatspre14b 
Examples of: graphics, multi-touch, 
synchronized audio, menus, settings, dialogs, 
intent-filters, multiple activities, persistent data, 
multi-threading, file browser, and more... 
(screenshot taken Jan 12, 2011, prior to 1.4b release)
•Useful Links/Resources 
 #android-dev at freenode.irc.net 
 Android Developers 
http://developer.android.com/index.html 
• Dev Guide = fundamentals 
• Reference = Google's Javadocs 
• Resources = Tips and conventions 
• Blog = Newest updates, code examples 
 android-developers@googlegroups.com 
http://www.mail-archive.com/android-developers@googlegroups.com/ 
 StackOverflow – public Q&A 
http://stackoverflow.com/questions/tagged/android 
 anddev.org – forums with lots of tutorials 
http://www.anddev.org/ 
 App Inventor Beta – Google's test project 
http://appinventor.googlelabs.com/about/index.html
Questions? Office Hours 8-10pm, Sat. Jan 16

Contenu connexe

Tendances

Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Svetlin Nakov
 
Best Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppBest Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppFlurry, Inc.
 
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
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espressoÉdipo Souza
 
Android deep dive
Android deep diveAndroid deep dive
Android deep diveAnuSahniNCI
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android DevelopersJosiah Renaudin
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersAmbarish Hazarnis
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2Shem Magnezi
 
Automated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracerAutomated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracerKyungmin Lee
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Daniel Knott
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingBitbar
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesIvano Malavolta
 
Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGapDoncho Minkov
 
Basic android development
Basic android developmentBasic android development
Basic android developmentUpanya Singh
 

Tendances (20)

Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021Appium Mobile Testing: Nakov at BurgasConf - July 2021
Appium Mobile Testing: Nakov at BurgasConf - July 2021
 
Android Applications Development
Android Applications DevelopmentAndroid Applications Development
Android Applications Development
 
Android Lab
Android LabAndroid Lab
Android Lab
 
Best Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality AppBest Strategy for Developing App Architecture and High Quality App
Best Strategy for Developing App Architecture and High Quality App
 
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
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
Android deep dive
Android deep diveAndroid deep dive
Android deep dive
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
Installing the java sdk
Installing the java sdkInstalling the java sdk
Installing the java sdk
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - Beginners
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
 
Automated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracerAutomated Historical Performance Analysis with kmemtracer
Automated Historical Performance Analysis with kmemtracer
 
Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012Mobile App Testing ScanAgile 2012
Mobile App Testing ScanAgile 2012
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Android Test Automation Workshop
Android Test Automation WorkshopAndroid Test Automation Workshop
Android Test Automation Workshop
 
Getting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App TestingGetting Started with XCTest and XCUITest for iOS App Testing
Getting Started with XCTest and XCUITest for iOS App Testing
 
PhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device CapabilitiesPhoneGap: Accessing Device Capabilities
PhoneGap: Accessing Device Capabilities
 
Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGap
 
Multitasking in iOS 7
Multitasking in iOS 7Multitasking in iOS 7
Multitasking in iOS 7
 
Basic android development
Basic android developmentBasic android development
Basic android development
 

Similaire à Synapseindia android apps intro to android development

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
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android ApplicationArcadian Learning
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramioslesulvy
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialkatayoon_bz
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialEd Zel
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studiobryan costanich
 
androidPramming.ppt
androidPramming.pptandroidPramming.ppt
androidPramming.pptBijayKc16
 

Similaire à Synapseindia android apps intro to android development (20)

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
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android Basic
Android BasicAndroid Basic
Android Basic
 
Android
Android Android
Android
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Android
AndroidAndroid
Android
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramio
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android
AndroidAndroid
Android
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android-Tutorial.ppt
Android-Tutorial.pptAndroid-Tutorial.ppt
Android-Tutorial.ppt
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
Android by LAlitha
Android by LAlithaAndroid by LAlitha
Android by LAlitha
 
androidPramming.ppt
androidPramming.pptandroidPramming.ppt
androidPramming.ppt
 
Google Android
Google AndroidGoogle Android
Google Android
 

Plus de Synapseindiappsdevelopment

Synapse india elance top in demand in it skills
Synapse india elance top in demand in it skillsSynapse india elance top in demand in it skills
Synapse india elance top in demand in it skillsSynapseindiappsdevelopment
 
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseindiappsdevelopment
 
SynapseIndia dotnet development platform overview
SynapseIndia  dotnet development platform overviewSynapseIndia  dotnet development platform overview
SynapseIndia dotnet development platform overviewSynapseindiappsdevelopment
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications developmentSynapseindiappsdevelopment
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security developmentSynapseindiappsdevelopment
 
SynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architectureSynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architectureSynapseindiappsdevelopment
 
SynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseindiappsdevelopment
 
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseindiappsdevelopment
 
SynapseIndia dotnet client library Development
SynapseIndia dotnet client library DevelopmentSynapseIndia dotnet client library Development
SynapseIndia dotnet client library DevelopmentSynapseindiappsdevelopment
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseindiappsdevelopment
 

Plus de Synapseindiappsdevelopment (20)

Synapse india elance top in demand in it skills
Synapse india elance top in demand in it skillsSynapse india elance top in demand in it skills
Synapse india elance top in demand in it skills
 
SynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture moduleSynapseIndia dotnet web development architecture module
SynapseIndia dotnet web development architecture module
 
SynapseIndia dotnet module development part 1
SynapseIndia  dotnet module development part 1SynapseIndia  dotnet module development part 1
SynapseIndia dotnet module development part 1
 
SynapseIndia dotnet framework library
SynapseIndia  dotnet framework librarySynapseIndia  dotnet framework library
SynapseIndia dotnet framework library
 
SynapseIndia dotnet development platform overview
SynapseIndia  dotnet development platform overviewSynapseIndia  dotnet development platform overview
SynapseIndia dotnet development platform overview
 
SynapseIndia dotnet development framework
SynapseIndia  dotnet development frameworkSynapseIndia  dotnet development framework
SynapseIndia dotnet development framework
 
SynapseIndia dotnet web applications development
SynapseIndia  dotnet web applications developmentSynapseIndia  dotnet web applications development
SynapseIndia dotnet web applications development
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security development
 
SynapseIndia mobile build apps management
SynapseIndia mobile build apps managementSynapseIndia mobile build apps management
SynapseIndia mobile build apps management
 
SynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architectureSynapseIndia mobile apps deployment framework internal architecture
SynapseIndia mobile apps deployment framework internal architecture
 
SynapseIndia java and .net development
SynapseIndia java and .net developmentSynapseIndia java and .net development
SynapseIndia java and .net development
 
SynapseIndia dotnet development panel control
SynapseIndia dotnet development panel controlSynapseIndia dotnet development panel control
SynapseIndia dotnet development panel control
 
SynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client library
 
SynapseIndia php web development
SynapseIndia php web developmentSynapseIndia php web development
SynapseIndia php web development
 
SynapseIndia mobile apps architecture
SynapseIndia mobile apps architectureSynapseIndia mobile apps architecture
SynapseIndia mobile apps architecture
 
SynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architectureSynapseIndia mobile apps deployment framework architecture
SynapseIndia mobile apps deployment framework architecture
 
SynapseIndia mobile apps
SynapseIndia mobile appsSynapseIndia mobile apps
SynapseIndia mobile apps
 
SynapseIndia dotnet development
SynapseIndia dotnet developmentSynapseIndia dotnet development
SynapseIndia dotnet development
 
SynapseIndia dotnet client library Development
SynapseIndia dotnet client library DevelopmentSynapseIndia dotnet client library Development
SynapseIndia dotnet client library Development
 
SynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically developmentSynapseIndia creating asp controls programatically development
SynapseIndia creating asp controls programatically development
 

Synapseindia android apps intro to android development

  • 1.
  • 2. Why mobile?  smartphones = “new thing”  portable, powerful Why Android? (over iOS)  Linux → Open Source  Consumer-driven apps  Hardware/software choice  Google <3 Devs
  • 3.
  • 4.
  • 5. Overview  Java  Eclipse  Hello World  Activity Cycle  Try API Demos  Stopwatch Example  Logcat/DDMS Debugging  Market Publishing and more...  Beats and Useful Resource Links
  • 6. Android Java  Linux, but apps in Java  Dalvik Virtual Machine – DVM  .apk format ← Eclipse  Standard java.* packages  Custom graphics/UI code  NDK – C/C++ for ARM (OpenGL ES 2.0, libraries, etc.)
  • 7.
  • 8. Eclipse  FOSS, customizable, industry-standard  Android-ready Download these (if you haven't already) Eclipse Classic 3.6.1 http://www.eclipse.org/downloads/packages/eclipse-classic-361/Android SDK R8 (get the .zip) http://developer.android.com/sdk/index.html Java SE Development Kit 6u23 (JDK) http://www.oracle.com/technetwork/java/javase/downloads/index.Code Samples used http://www.stwing.upenn.edu/~pengp/Files/PennApps/PennApps_
  • 9. Setup (Live Demo!)  Install JDK (run installer)  Extract Eclipse (e.g. C:/Android/eclipse)  Install Android SDK  Extract Android SDK (e.g. C:/Android/android-sdk-windows)  Run SDK Manager  Select packages (only need Platform-tools, API 9, document, and samples)  Download and wait (long)  Virtual Devices > New  Name: “TestPhone2.3”, Target: Android 2.3 – API Level 9, SD Card Size: 64 MiB  Create AVD > Start... > Launch  A virtual Android 2.3 phone for testing! Yay o/
  • 10. Setup (Live Demo! Continued)  Install ADT Plugin for Eclipse:  http://developer.android.com/sdk/eclipse-adt.html#installing  Help > Install New Software.... > Add  https://dl-ssl.google.com/android/eclipse/ → “ADT”  Select All > Next > Next > Accept Terms > Finish > Restart  Windows > Preferences... > Android  Browse (find “android-sdk-windows” folder) > Apply > OK  Eclipse is now ready for Android development! Ready for your Android “Hello World”?
  • 11. Hello World File > New > Project > Android > Android Project
  • 12. Hello World Add the following lines marked by “// <-----”
  • 13. Hello World Run > Run > Android Application
  • 14. Hello World Inspection Package naming convention? Activity, Layout, TextView? R, src, res, AndroidManifest?
  • 15. Activity Cycle Activity = methods + Layout + Dialogs  Layout = Views, Buttons, etc. App = many Activities  Task = stack of Activities from one app Also: Services, Broadcast Receivers, Content Providers
  • 16. API Demos  File > New > Projects > Android Project Create project from existing source (C:Androidandroid-sdk-windows samplesandroid-9ApiDemos) Right click ApiDemos project > Refresh  src > com.examples.android.apis > ApiDemosApplication Run > Run > Android Application (or Ctrl+F5) Explore the demos! Ready to try it yourself?
  • 17. Stopwatch 1 Hello World, but need time and screen updating  FormattedTime.java and RefreshHandler.java FormattedTime  start() - starts timer, returns “00:00:00”  stop() - stops timer, returns time “MM:SS:mm”  reset() - resets timer, returns “00:00:00”  update() - returns time “MM:SS:mm” RefreshHandler  start(delay) - starts calling update() every delay ms  stop() - stops calling update()  update() - override this with your code
  • 18. Stopwatch A Hello World, with FormattedTime and RefreshHandler But this just keeps running, what about stopping or resetting?
  • 19. Views, Images and Buttons, Oh My! Activity.setContextView(layout) Graphical layout → XML Add in Widgets or more Views ViewGroups: LinearLayout, TableLayout, RelativeLayout, ScrollView, ListView, GridView Widgets/Content Views: TextView, WebView,ImageView ImageButton, Button, Checkbox, EditText, RadioButton See Android documentation for details and more http://developer.android.com/guide/topics/ui/index.html
  • 20. Stopwatch B Buttons for Start, Stop, Reset Give TextView an id for reference Good practice: use strings.xml  onClick → method Use GridView or other ViewGroups for nicer layout
  • 21. Stopwatch B Cross-reference TextView (recast)  onClick must be public void foo(View view)
  • 22. Stopwatch C  Lets add unnecessary stuff!
  • 23.
  • 24. More Common Stuff Graphics: http://developer.android.com/ →  Static → XML layouts  Active → Canvas  3D → OpenGL ES 1.x or 2.0 (NDK) Audio/Video:  Playback → MediaPlayer  Recording → MediaRecorder Data:  Settings → PreferenceActivity & PreferenceManager  Storage → External Storage, SQLite Network:  Connectivity → ConnectivityManager  Locations → Uri* Interactivity:  Multiple activities → Intents  Other apps/Content handling → Intent Filters
  • 25. Debugging! Logcat!!! (and DDMS later)  Log.v(String tag, String msg) Also Log.v, .w, .d, .wtf ADB  android-sdk-*/platform-tools/adb  adb push/pull/install  adb shell  adb logcat
  • 26. DDMS (Dalvik Debug Monitor Server) Eclipse integrated Android debugger Windows > Open Perspective > Other... > DDMS Select device, select process Debug, Update Heap, Update Threads Allows inspection of threads, heap, allocation, files, etc. Also displays Logcat and allows for screenshots!
  • 27.
  • 28. Market and Actual Testing? Windows > Android SDK & AVD Manager Available packages > Third party Add-ons Google Usb Driver and Market Licensing On your actual phone: MENU > Settings > Applications > Development > USB debugging ON Plug in, compile and run your Android app, select your actual phone (or might auto-select)
  • 29. Publishing on the Market http://market.android.com/publish/Home http://developer.android.com/guide/publishing/publishing.$25 one-time fee for a developer account Make money back via either paid app or advertisements (AdMob) Compare to iOS's $99/YEAR and content filtering/approval-based system Need to make sure to check support for different screen sizes, Android OS (current is 2.3 but lots still run 1.5/1.6), etc. in AndroidManifest.xml file
  • 30. Beats, Advanced Rhythm Game Website: http://beatsportable.com Try it: http://www.tinyurl.com/beatspre14b Examples of: graphics, multi-touch, synchronized audio, menus, settings, dialogs, intent-filters, multiple activities, persistent data, multi-threading, file browser, and more... (screenshot taken Jan 12, 2011, prior to 1.4b release)
  • 31. •Useful Links/Resources  #android-dev at freenode.irc.net  Android Developers http://developer.android.com/index.html • Dev Guide = fundamentals • Reference = Google's Javadocs • Resources = Tips and conventions • Blog = Newest updates, code examples  android-developers@googlegroups.com http://www.mail-archive.com/android-developers@googlegroups.com/  StackOverflow – public Q&A http://stackoverflow.com/questions/tagged/android  anddev.org – forums with lots of tutorials http://www.anddev.org/  App Inventor Beta – Google's test project http://appinventor.googlelabs.com/about/index.html
  • 32. Questions? Office Hours 8-10pm, Sat. Jan 16