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

Benjamin Weiss

October 13, 2012
Tweet

More Decks by Benjamin Weiss

Other Decks in Technology

Transcript

  1. 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
  2. Agenda • The Setup • Hello Android • AndroidManifest.xml •

    Intents • Views • Respond to user-interaction • Using libraries • Hands on
  3. 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>
  4. 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" >
  5. 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 />
  6. 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 /> !
  7. 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>
  8. 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> !
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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>
  14. Views public class OneOhOneDemo extends Activity{ @Override public void onCreate(Bundle

    savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } ... }
  15. 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