• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,597
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
72
Comments
0
Likes
0

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. J2ME: Midlet public class HelloWorld extends MIDlet { private TextBox tbox; Android public HelloWorld() { tbox = new TextBox("Hello world MIDlet", "Hello World!", 25, 0); } Une approche au dévelopement d’applications sur protected void startApp() { mobiles Display.getDisplay(this).setCurrent(tbox); } protected void pauseApp() {} protected void destroyApp(boolean bool) {} } } 1 3 J2ME & Android Android: Activity public class LocateMe extends Activity { • J2ME utilise des midlets (MIDP 3.0, 2008) public void onCreate(Bundle params) { super.onCreate(params); • Android utilise des activities. setContentView(R.layout.main); } public boolean onKeyDown(int keyCode, KeyEvent event) { return true; } } 2 4
  • 2. Activity Android:View Android's XML content views (J2ME: Displayable) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:layout_centerHorizontal="true" android:text="Press the center key to locate yourself" /> </RelativeLayout> 5 7 View View A reference number must be set for the XML file so that Android can find it from your source code public final class R { public static final class layout { public static final int main=0x7f030001; } } 6 8
  • 3. View Views may be nested Widget library (built on top of the View class) for scrollbars, text- entry, progress-bars, and many more a View in Android must overload only one function onDraw() public void onDraw(Canvas cvs){ Paint p = new Paint(); String sLat = "Latitude: " + overlord.getLat(); String sLon = "Longitude: " + overlord.getLon(); cvs.drawText(sLat , 32, 32, p); cvs.drawText(sLon, 32, 44, p); } 9 11 <?xml version="1.0" encoding="utf-8"?> <!-- Demonstrates using a relative layout to create a form --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/blue" android:padding="10px"> <TextView id="@+id/label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Type here:"/> <EditText id="@+id/entry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:layout_below="@id/label"/> <Button id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/entry" android:layout_alignParentRight="true" android:layout_marginLeft="10px" android:text="OK" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeft="@id/ok" android:layout_alignTop="@id/ok" android:text="Cancel" /> </RelativeLayout> 10 12
  • 4. 13 15 14 16
  • 5. 17 19 <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:id="@+id/myAbsoluteLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/black" xmlns:android="http://schemas.android.com/apk/res/android"> <Spinner android:id="@+id/mySpinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_x="0px" android:layout_y="82px" > </Spinner> <Button id="@+id/myButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/darkgray" android:text="Ok" android:layout_x="80px" android:layout_y="122px" > </Button> </AbsoluteLayout> 18 20
  • 6. 21 23 22 24
  • 7. http://www.droiddraw.org/ Eclipse views • Devices • list of running emulators • Emulator Control • Lets you simulate incoming voice and SMS messages and simulate different telephony states • File Explorer • Heap, Processes, Threads • LogCat 25 27 http://code.google.com/p/openintents/wiki/SensorSimulator Capteurs TP1 Android 3rd party plugin for the Android emulator http://code.google.com/android/documentation.html 1 Installer le sdk et 2 Faire le tp stax1 essayer Hello Android avec Android 26 28
  • 8. Resources Androidology Videos - A set of overview videos from the Android development team. The official Android site. The official Android bug tracker / issue list. wiki.droiddocs.net - Unofficial Android Wiki • DroidDocs list of known bugs - Google didn't initially have a publicly accessible bug tracker, so this used to be the best place to report and assess bugs. http://www.android-freeware.org/ - A growing list of applications under development. Forums http://groups.google.com/group/android-beginners/ http://groups.google.com/group/android-developers http://www.anddev.org/ 29