Your SlideShare is downloading. ×
0
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Android basics
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Android basics

3,875

Published on

Introduction to Android workshop for Hakkavélin hackerspace in Reykjavík January 2012

Introduction to Android workshop for Hakkavélin hackerspace in Reykjavík January 2012

Published in: Education, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,875
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
115
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Introduction to Android Programming – Workshop Berglind Ósk Bergsdóttir CC-BY-SA 2012
  • 2. Android applications <ul><li>Open development platform written in Java
  • 3. The Android SDK tools compile the code into an Android package (.apk)
  • 4. The Android operating system is a multi-user Linux system ( 2.6 ) in which each application is a different user.
  • 5. Each process has its own instance of the Dalvik virtual machine. </li></ul>
  • 6. Android Manifest.xml <ul><li>A must for every application in its root directory
  • 7. Info about version number, min sdk version, install location
  • 8. User permissions
  • 9. Declare activities, services, broadcast receievers... </li><ul><li>launchMode, screenOrientation, theme: </li></ul><li>android:theme=&quot;@android:style/Theme.NoTitleBar&quot; </li></ul>
  • 10. UI – resources folder <ul><li>Xml layout files </li><ul><li>layout-hdpi, -mdpi, -ldpi, -land, -xlarge
  • 11. LinearLayout, RelativeLayout </li></ul><li>Drawables </li><ul><li>drawable-hdpi, -mdpi, -ldpi </li></ul><li>Menus and context menus
  • 12. Values </li><ul><li>strings </li></ul></ul>
  • 13. UI –LinearLayout
  • 14. Activity <ul><li>Typically represents one screen
  • 15. Must implement onCreate(Bundle savedInstanceState)
  • 16. Needs a view (xml layout file) setContentView(R.layout.activity_layout )
  • 17. When a new activity starts, it is pushed onto the back stack </li><ul><li>&quot;last in, first out&quot; </li></ul><li>ListActivity
  • 18. Fragments (API level 11> = 3.0>) </li></ul>
  • 19.  
  • 20. Activity <ul><li>Starting an activity
  • 21. Getting extras </li></ul>
  • 22. Adapters <ul><li>Populates a view with data
  • 23. Handles user selections
  • 24. BaseAdapter with listviews
  • 25. http://developer.android.com/resources/tutorials/views/hello-gridview.html </li></ul>
  • 26. Service <ul><li>Long running operation in background
  • 27. startService();
  • 28. bindService();
  • 29. Runs in the main thread!! </li></ul>
  • 30. AsyncTask <ul><li>A neat way to do heavy background thread work like talking to webservice
  • 31. defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute. </li></ul>
  • 32. Application <ul><li>Base class to maintain global application state
  • 33. Instantiated for you when the process for your application/package is created. </li></ul>
  • 34. Data Storage <ul><li>Shared Preferences </li><ul><li>Store private primitive data in key-value pairs. </li></ul><li>Internal Storage </li><ul><li>Store private data on the device memory. </li></ul><li>External Storage </li><ul><li>Store public data on the shared external storage. </li></ul><li>SQLite Databases </li><ul><li>Store structured data in a private database. </li></ul><li>Network Connection </li><ul><li>Store data on the web with your own network server. </li></ul></ul>
  • 35. Shared prefs
  • 36. Debugging <ul><li>adb (Android Debug Bridge) is a command line tool to communicate to device/emulator </li><ul><li><sdk>/platform-tools/adb logcat
  • 37. Logcat also in Eclipse </li></ul><li>Log.d(TAG, “This is a log msg”);
  • 38. v(verbose), d(debug), i(info), e(error), w(warning) </li><ul><li>adb logcat *:D
  • 39. adb logcat | ~/coloredlogcat.py
  • 40. http://jsharkey.org/blog/2009/04/22/modifying-the-android-logcat-stream-for-full-color-debugging/ </li></ul></ul>
  • 41. <ul><ul>Let's do some coding!! </ul></ul>
  • 42. Hello world! <ul><li>http://developer.android.com/resources/tutorials/hello-world.html
  • 43. Remove ugly title bar on top </li><ul><li>android:theme=&quot;@android:style/Theme.NoTitleBar&quot; </li></ul><li>Add a button </li><ul><li><Button android:text=&quot;Button&quot;
  • 44. android:id=&quot;@+id/button1&quot;
  • 45. android:layout_width=&quot;wrap_content&quot;
  • 46. android:layout_height=&quot;wrap_content&quot;></Button> </li></ul></ul>
  • 47. Hello world! <ul><li>Click button to share on facebook/twitter/email </li></ul>Intent intent = new Intent(Intent. ACTION_SEND ); intent.setType( &quot;text/plain&quot; ); intent.putExtra(Intent. EXTRA_SUBJECT , &quot;email subject&quot; ); intent.putExtra(Intent. EXTRA_TEXT , &quot;must be a url to post this text to facebook&quot; ); startActivity(Intent. createChooser (intent, &quot;Share...&quot; ));
  • 48. More tutorials <ul>http://developer.android.com/resources/tutorials/views/index.html </ul>
  • 49. The end <ul><li>Advanced Android workshop later!
  • 50. Slides on slideshare.net
  • 51. [email_address]
  • 52. @beggaboo85 </li></ul>

×