Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Android Programming

No description

Stephan Branczyk

on 15 March 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Android Programming

Morning Android Programming Class
at HTC, (Mountain View Office) Stephan Branczyk http://blog.nielsen.com/nielsenwire/?p=26562 @frenchaccent (Twitter/LinkedIn) 29% 27% 27% RIM
BlackBerry Apple Android US Smartphones
Operating Systems Shares * note: Nov 10- Jan 11, postpaid mobile subscribers http://prezi.com What is Android ?

“Android is a software stack for mobile devices that includes an operating system, middleware, and key applications” - Google houses House() Android Stack Applications Application Framework Libraries ??????? ????????? Android Runtime ?????? Virtual Machine Core Libraries HelloMrAndroid.zip HelloMrAndroid.apk extension .zip is renamed to .apk
The rest of the file is othwerwise identical Code Editor Project lower tabs plugin for
this class resize classes.dex res AndroidManifest.xml Exercise 1.2: Run your project apk file is being pushed unto device adb push http://www.flickr.com/photos/eklektikos/2541408630/ http://freeaussiestock.com/free/Northern_Territory/slides/abandoned_house.htm http://www.geograph.org.uk/photo/9804 http://www.willsimpson.org/160/wind-storm-2006 Project
File Structure overlay blueprints (intermediary) Java Bytecode (intermediary) Dalvik Bytecode hellomrandroid.class Start Exercises expected results click on
Wait for lab exercises 1.1 through 1.3 Application Non Responding (ANR) affectionately nicknamed "nanar" or "anar" by some developers triggered at 5+ seconds of wait perfectly normal on emulator
(depending your development machine) Android standard Key-lock Window > Window > Open Perspective > Other... Close All Perspectives Place the androidbootcamps eclipse plugin jar file into your
'.../eclipse/plugins/' directory Then restart Eclipse Click on Then click on Note that these are Japanese characters. So if you happen to get them, and don't know what they mean, it's a good chance it means your emulator is set to the wrong default input language. To set it back to English, click inside the input box for at least 3 seconds, select 'Input Text Method', and select English. setContentView( ); accordingly LinearLayout uselessLinearLayout = new LinearLayout(this);

Button uselessButton = new Button(this);

uselessLinearLayout.addView(uselessButton); uselessLinearLayout vs. new Basement Plumbing GroundFloor Roof Java Java Bytecode Dex Bytecode Java compiler Dalvik compiler Dalvik Virtual Machine Hello.java Hello.class Hello.dex Hello.java Java + xml main.xml aapt packager R.java in Android, you almost always
start programming with an Activity Activity Stacks Hello Mr Android src Android 1.6 gen assets res com.androidbootcamps.mr_android HelloSir.java com.androidbootcamps.mr_android R.java [Generated Java Files] drawable-hdpi drawable-ldpi drawable-mdpi layout values main.xml strings.xml AndroidManifest.xml default.properties icon.png icon.png icon.png Do exercises 2.1
and 2.2 firewall rules contract between the developer and user manifest of a ship Game Engine http://www.andengine.org/forums/tutorials/eclipse-andengine-and-helloworld-t380.html AndEngine.org Activities and Services Phone Call activities aapt android-11/ ant/ etc1tool lib/ see this bug report to get more resources as they are added Jet/ emulator lib/ android-8/sources/android-8-src.zip zipalign ddms dmtracedump platform-tools/ ???????? http://code.google.com/p/android/issues/detail?id=979 platforms/ android-sdk/ draw9patch aidl traceview proguard/ dexdump android-7/sources/android-7-src.zip mksdcard android tools/ dx adb android-3/sources/android-3-src.zip apkbuilder sqlite3 Android
Development Tools android-4/sources/android-4-src.zip expected results onStop() maybeOnStop() Central Organizing
Principles onPause() onInvisibility() onRestart() onCreate() onResume() onDestroy() maybeOnCleanUp() onVisibility() Android
Toolchain http://developer.android.com/resources/dashboard/screens.html Android Stack Applications Application Framework Libraries Linux Kernel Android Runtime Dalvik Virtual Machine Core Libraries Hardware android-12/ Icons/Drawables explicit
implicit Intents explicit intent to an Activity in your application One correct answer would be this: Calling an external activity This would make too much sense.
However this is incorrect. :( Why wouldn't this work? One more tricky requirement inside the Manifest file of our own application: (even for calling an external activitity) We've just dealt with the Manifest file of our own application.

What about the Manifest file of the external application
we're calling? What are we assuming about it? Activities
subactivities Now with
Android Player! Event-based System Intents are Events Back Button
Home Button ViewGroup View ? ? ? Knowing this, how would you write an explicit intent
targeted at an Activity outside of your own application?

Assume that the package name of this outside application is com.panda AnalogClock ImageView ViewStub KeyboardView ProgressBar SurfaceView TextView SlidingDrawer RelativeLayout Android
UI Design Go through the Google I/O 2011 Scheduler
App to glean the most up-to-date information
on UI Design and cross-device compatibility. Make it easier on yourself as a programmer
by using the official dimensions from the start. onStart() http://code.google.com/p/iosched/ http://developer.android.com/guide/practices/ui_guidelines/icon_design.html Sizes vs. Densities http://www.slideshare.net/AndroidDev/android-ui-design-tips More Comprehensive
List of Android UI tips Structural OS Differences Aside from the obvious differences
in sizes and densities, we also have... Activities and themes Services & Notifications Make sure your customers and UI Designers own and
have used an Android phone personally for at least
a couple of weeks (owning an iPhone is not enough). Buttons and Gestures Reject iPhone-like prototypes in favor of Android-like
prototypes and reject pixel-perfect prototypes in favor
of more like sketch-like imperfect prototypes. 864 * 864 Knowing the Android user flow Theory is not the
same as having experienced Android personally. Pre-screen your Customers and
Designers early on Broadcast Receivers Android vs. iPhone It will be easier when you start using your own styles and your own themes (as programmers, styles and themes will make your life easier). And it will also be easier for when carriers apply their own custom themes to your app. No matter what dimensions of your small icons, work on them at 864 * 864
and then scale them down to the exact size you need. Different Orientation Defaults onResume() is called whether it's the first time or the
second time the Activity is running.

I know this is confusing, but when onResume() is called,
it's the UI thread that's "resuming", not necessarily
the Activity. Java Java Bytecode Dex Bytecode Java compiler Dalvik compiler Dalvik Virtual Machine Hello.java Hello.class Hello.dex Hello.java Java + xml main.xml aapt packager R.java This method onVisibility() doesn't actually exist. It's just what I would have called onResume() if I could, because onVisibility() is a much more accurate term for what's really going on. http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html Creative Commons License - Stephan Branczyk -
Attribution-NonCommercial 3.0 Unported License
Free to also use for your own in-house training http://creativecommons.org/licenses/by-nc/3.0/ Import 'OnClickListener' from (android.view.View) When given a choice, select the The other one won't work. (Change of State) > Java Where is this file being called from?
How does the application know it's the first one to start with? This is out Out of Date!

This tool has now been rewritten and integrated
as part of the Android Developer Tools LinearLayout Broadcast Receivers? sendBroadcast(Intent intent) sendBroadcast(Intent intent, String receiverPermission) sendOrderedBroadcast(Intent intent, String receiverPermission) Broadcast Receivers Why Broadcast Receivers vs. implicit Intents without user intervention intent filtering Install 'Android Intent Playground'
by Diego Torres Milano from the Market https://market.android.com/details?id=com.codtech.android.intentplayground&hl=en Spinner ListView ... ... ... iPhone/iOS 5.0 is introducing notifications Past conferences Stephan Branczyk @frenchaccent (Twitter/LinkedIn/Facebook) stephan http://slides.androidbootcamps.com http://www.androidbootcamps.com/files/ http://slides.androidbootcamps.com Friday November 11, 2011 http://penapi.eventbrite.com/ http://meetup.com/AndroidClasses (free less structured meetup that I host) @branczyk .org
Full transcript