Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android 101 DevFest Berlin 2012

Android 101 DevFest Berlin 2012

Slides of my Android 101 session at the DevFest Berlin 2012

D2a06312762581d504ba0a25e5a90def?s=128

Benjamin Weiss

October 13, 2012
Tweet

More Decks by Benjamin Weiss

Other Decks in Technology

Transcript

  1. Android 101 workshop Getting started with Android development

  2. Benjamin Weiss http://gplus.to/keyboardsurfer Twitter: @keyboardsurfer Senior Software Developer at ImmobilienScout24

    Organizer: GDG Android in Berlin Co-Organizer: • Global Android Dev Camp • GTUG Community Weekend • Google I/O Extended Berlin 2012 • DevFest Berlin 2012
  3. Agenda • The Setup • Hello Android • AndroidManifest.xml •

    Intents • Views • Respond to user-interaction • Using libraries • Hands on
  4. The Setup Platform of choice Linux Mac Windows Android

  5. The Setup Development Environment http://eclipse.org https://www.jetbrains.com/idea AIDE https://play.google.com/store/apps/details? id=com.aide.ui

  6. The Setup Android SDK https://developer.android.com/sdk/index.html

  7. Hello Android

  8. AndroidManifest.xml https://developer.android.com/ guide/topics/manifest/ manifest-intro.html

  9. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest>
  10. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest> <manifest xmlns:android= "http://schemas.android. com/apk/res/android" android:installLocation="auto" package="my.package.name" android:versionCode="42" android:versionName="theLifeTheUniverseAndEverything-Beta" >
  11. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest> <uses-permission />
  12. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest> <uses-permission /> !
  13. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity>
  14. AndroidManifest.xml <manifest> <uses-permission /> <permission /> <permission-tree /> <permission-group />

    <instrumentation /> <uses-sdk /> <uses-configuration /> <uses-feature /> <supports-screens /> <compatible-screens /> <supports-gl-texture /> <application> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> <activity-alias> <intent-filter> . . . </intent-filter> <meta-data /> </activity-alias> <service> <intent-filter> . . . </intent-filter> <meta-data/> </service> <receiver> <intent-filter> . . . </intent-filter> <meta-data /> </receiver> <provider> <grant-uri-permission /> <meta-data /> </provider> <uses-library /> </application> </manifest> <activity> <intent-filter> <action /> <category /> <data /> </intent-filter> <meta-data /> </activity> !
  15. Intent An intent is an abstract description of an operation

    to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.
  16. Intent An intent is an abstract description of an operation

    to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.
  17. Intent An Intent provides a facility for performing late runtime

    binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.
  18. Intent An Intent provides a facility for performing late runtime

    binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.
  19. Intent

  20. Views <?xml version ="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android" android:layout_width ="fill_parent"

    android:layout_height ="fill_parent" android:paddingLeft ="16dp" android:paddingRight ="16dp" android:orientation ="vertical" > <EditText android:layout_width ="fill_parent" android:layout_height ="wrap_content" android:hint ="@string/to" /> <EditText android:layout_width ="fill_parent" android:layout_height ="wrap_content" android:hint ="@string/subject" /> <EditText android:layout_width ="fill_parent" android:layout_height ="0dp" android:layout_weight ="1" android:gravity ="top" android:hint ="@string/message" /> <Button android:layout_width ="100dp" android:layout_height ="wrap_content" android:layout_gravity ="right" android:text ="@string/send" /> </LinearLayout>
  21. Views public class OneOhOneDemo extends Activity{ @Override public void onCreate(Bundle

    savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } ... }
  22. Views

  23. User interaction someView.setOnClickListener(new OnClickListener() { public void onClick(View view) {

    //handle event } });
  24. Libraries

  25. Libraries • Support Library • android-json-rpc • oauth-signpost • greenDAO

    • GSON • ...
  26. Important links https://developer.android.com https://developer.android.com/sdk/index.html https://developer.android.com/guide/components/index.html https://developer.android.com/training/basics/firstapp/index.html https://stackoverflow.com http://www.openintents.org/en/libraries

  27. Questions

  28. Get your keyboards clicking!

  29. Thank you Benjamin Weiss http://gplus.to/keyboardsurfer Twitter: @keyboardsurfer

  30. Image Sources • http://www.devfest.info/images/vhabig.png • https://en.wikipedia.org/wiki/Linux • https://en.wikipedia.org/wiki/Windows • https://en.wikipedia.org/wiki/Windows

    • https://d.android.com • http://www.eclipse.org/artwork/ • https://www.jetbrains.com/img/logos/logo_intellij_idea.gif • https://play.google.com/store/apps/details?id=com.aide.ui • https://developer.android.com/sdk/index.html • https://developer.android.com/reference/packages.html • https://developer.android.com/guide/topics/ui/layout/linear.html • http://curiousexpeditions.org/?p=78 • http://actionbarsherlock.com • https://code.google.com/p/roboguice • http://marie-schweiz.de