• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Android basics
 

Android basics

on

  • 3,328 views

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

Statistics

Views

Total Views
3,328
Views on SlideShare
3,328
Embed Views
0

Actions

Likes
2
Downloads
105
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Android basics Android basics Presentation Transcript

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