You are on page 1of 91

Android in 40min

@kevinmcdonagh
Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

http://www.geminoid.jp
Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Install repo
$ curl https://android.git.kernel.org/repo > ~/bin/repo $ chmod a+x ~/bin/repo

Download source
$ repo init -u git://android.git.kernel.org/platform/manifest.git $ repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

http://www.youtube.com/watch?v=Ahg8OBYixL0
Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Activities Content Providers Broadcast Recievers Services

Friday, 16 September 11

Friday, 16 September 11

Explicit Intents

Broadcasted Implicit Intents

Friday, 16 September 11

<reciever android:name="MyReciever" /> <intent-filter> <action android:name="DO_SOMETHING" /> </intent-filter> </reciever>

public class MyReciever extends BroadcastReciever {


@Override

public void onRecieve(Context ctx, Intent i){ Intent ss = new Intent(ctx, MyService.class); ctx.startService(ss); } }

Friday, 16 September 11

Intent intent = new Intent (......................); startActivity(intent);


Intent i = new Intent(); i.setAction(android.intent.action.PICK); i.setType(MediaStore.Audio.Playlists.CONTENT_TYPE); startActivity(i)
<intent-filter> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.dir/playlist" /> </intent-filter>

Friday, 16 September 11

Intent i = new Intent (Intent.ACTION_DIAL, Uri.parse(tel:799589844)); startActivity(i); i = new Intent(Intent.ACTION_VIEW, Uri.parse(http://www.droidcon.co.uk)); startActivity(i);

Friday, 16 September 11

Receive Message Check Scheme Check Contents Intercept SMS Pass Extras

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello"/>

</LinearLayout>

Friday, 16 September 11

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:style="@style/mystyle"/>

</LinearLayout>

Friday, 16 September 11

<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme" parent="android:Theme" /> <style name="Theme.MyApp" parent="android:style/Theme.Light"> <item name="android:windowNoTitle">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:editTextStyle">@style/Widget.EditText</item> <item name="android:windowBackground">@android:color/white</item> </style> <style name="Widget"> <item name="android:textAppearance">?android:attr/textAppearance</item> </style> <style name="Widget.EditText" parent="@android:style/Widget.EditText"> <item name="android:focusable">true</item> <item name="android:focusableInTouchMode">true</item> <item name="android:clickable">true</item> <item name="android:background">@drawable/edit_text</item> <item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item> <item name="android:textColor">@android:color/primary_text_light</item> <item name="android:gravity">left</item> </style> </resources>

Friday, 16 September 11

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.demo" android:versionCode="1" android:versionName="1.0"> <application android:label="@string/app_name" android:icon="@drawable/icon" android:label="@style/Theme.MyApp"> <activity android:name=".Activity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11" /> <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true" /> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="false" /> <compatible-screens> <screen a:screenDensity="ldpi" a:screenSize="small"/> </compatible-screens> </manifest>
Friday, 16 September 11

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.demo" android:versionCode="1" android:versionName="1.0">

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="11" /> <provider android:name=".MyProvider" android:authorities="com.demo" android:exported="false" /> <receiver android:name="MyPhoneReceiver"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"></action> </intent-filter> </receiver> <service android:name=".SilentListenerService"> <intent-filter> <action a:name="com.demo.actions.TAKE_NOTES" /> </intent-filter> </service> <application android:label="@string/app_name" android:icon="@drawable/icon"> <activity android:name=".Activity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

<supports-screens> <uses-conguration> <uses-feature> <uses-library> <uses-permission> <uses-sdk> <compatible-screens> <supports-gl-tecture>


Friday, 16 September 11

android.hardware.audio.low_latency android.hardware.bluetooth android.hardware.camera android.hardware.camera.autofocus android.hardware.camera.ash android.hardware.camera.front android.hardware.location android.hardware.location.network android.hardware.location.gps android.hardware.microphone android.hardware.nfc android.hardware.sensor.accelerometer android.hardware.sensor.barometer android.hardware.sensor.compass android.hardware.sensor.gyroscope android.hardware.sensor.light android.hardware.sensor.proximity android.hardware.telephony android.hardware.telephony.cdma android.hardware.telephony.gsm

android.hardware.faketouch android.hardware.touchscreen android.hardware.touchscreen.multitouch android.hardware.touchscreen.multitouch.distinct android.hardware.touchscreen.multitouch.jazzhand android.hardware.wi android.software.live_wallpaper android.software.sip android.software.sip.voip

Friday, 16 September 11

Dashboard Action Bar Search Bar Quick Actions Widget Notications


Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

<meta-data android:name="android.app.default_searchable" android:value=".activity.Contacts" />

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Class in App public class Widget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; for (int i=0; i<N; i++) { int appWidgetId = appWidgetIds[i]; Intent intent = new Intent(context, WillLaunchThis.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); views.setOnClickPendingIntent(R.id.button, pendingIntent); appWidgetManager.updateAppWidget(appWidgetId, views); } } }

Declaration in Manifest <receiver android:name="ExampleAppWidgetProvider" > <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/example_appwidget_info" /> </receiver>

Widget Properties <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="@dimen/widget_4cell" android:minHeight="@dimen/widget_1cell" android:initialLayout="@layout/widget_layout" android:label="@string/widget_label" android:updatePeriodMillis="3600000" /> <!-- 1 hour in milliseconds -->

Friday, 16 September 11

Friday, 16 September 11

http://developer.android.com/guide/practices/ui_guidelines/icon_design.html

Friday, 16 September 11

Friday, 16 September 11

Being Asynchronous Handlers AsyncTasks IntentService AsyncQueryHandler Loader and CursorLoader

Friday, 16 September 11

SQLite
/data/data/your.package.name/databases/

rawQuery()

Use ? as placeholders in the SQL statement for the parameters (SELECT * FROM foo WHERE _id=?)

Query()

Builds up a SQL query from component parts

Friday, 16 September 11

Adapters wrap around data models

ListAdapter ArrayAdapter SpinnerAdapter CursorAdapter SimpleAdapter BaseAdapter


Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Other things...

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

Friday, 16 September 11

www.novoda.com

@kevinmcdonagh

Friday, 16 September 11

You might also like