Swing ME Android Guide

Advantages of SwingME apps over native Android Apps

Advantages of native Android over SwingME

Setting up Android to Build a SwingME app

Here is a guide on building a SwingME app for Android. there may be a better way of doing this, but i have not worked that out yet, so for now this is what i do.

From the File menu select "New" then "Other"

Give your project a name, and tick the minimum Android API level for SwingME 1.6

Include AndroidME as a library project. In your project properties, add the created project under the ‘Libraries’ section of the ‘Android’ category.

Now we need to create new Activity that will run the "AndroidMeActivity". Create a AndroidManifest.xml and put this into there:

  1 <?xml version="1.0" encoding="utf-8"?>
  2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3       package="hello.world"
  4       android:versionCode="1"
  5       android:versionName="1.0">
  6     <application android:name="net.yura.android.AndroidMeApp" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/android:Theme.Light.NoTitleBar">
  7         <activity android:name="net.yura.android.AndroidMeActivity"
  8                   android:launchMode="singleTask"
  9                   android:label="@string/app_name"
 10                   android:windowSoftInputMode="adjustResize"
 11                   android:configChanges="orientation|keyboard|keyboardHidden">
 12             <intent-filter>
 13                 <action android:name="android.intent.action.MAIN" />
 14                 <category android:name="android.intent.category.LAUNCHER" />
 15             </intent-filter>
 16         </activity>
 17     </application>
 18 </manifest>

The way the that AndroidME knows what to start is by looking for a .jad file inside your "assets" dir, this file will be the ONLY file inside your assets dir as all your other app assets will be added as extra source folders in the "Source" tab of "Java Build Path"

Here is an example of what will go inside the jad file, unlike J2ME jad files no additional fields are needed.

MIDlet-1: TestMIDlet,,net.yura.mobile.test.MyMidlet

You can specify multiple files that extend Midlet like this:

MIDlet-1: TestMIDlet,,net.yura.mobile.test.MyMidlet
MIDlet-2: HelloMIDlet,,net.yura.mobile.test.SimpleMidlet
MIDlet-3: AndroidTest,,net.yura.android.TestMIDlet

Then when the Activity is launched it will present the user with a list of Apps to run