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

Android

on

  • 2,025 views

 

Statistics

Views

Total Views
2,025
Views on SlideShare
2,024
Embed Views
1

Actions

Likes
0
Downloads
71
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

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 Android Presentation Transcript

    • 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
    • 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
    • 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
    • 13 15 14 16
    • 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
    • 21 23 22 24
    • 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
    • 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