Android adapter

Environment setup

Eclipse and Android SDK

Note 1 : This has been validated with a 2.2 (froyo) android tablet. There is numerous versions of the Android OS running in the wild, and even the development environment could change from one major version to another. Always refer to the official android documentation.

Note 2 : Using real devices to test the application is almost mandatory.

The Android - Eclipse installation process :

  1. Download & install Eclipse
  2. install an Eclipse plugin (you can do without it in command line)
  3. launch Eclipse, go to Help > Install new Software
  4. paste https://dl-ssl.google.com/android/eclipse/ in the text input
  5. check the “Developer tools”, hit “next” two times then “finish” then “ok” and finally restart Eclipse
  6. get the Android SDK on http://developer.android.com/sdk/index.html
  7. reference it in Eclipse : go to Eclipse / Preferences / Android / SDK Location and hit the browse button
  8. choose the the Android Version of the device you are targeting. Eg: for the Samsung Galaxy Tab V1, it's 2.2 (or 8)

Check environment

Let‘s start with an hello world example on a real device
  1. File > New > Project and chose Android Project
  2. fill the fields. Eg for the Samsung Galaxy Tab V1:
  3. Edit android manifest.xml, set debuggable to true

Then use this code in the main class (in src):


import android.app.Activity;
import android.widget.TextView;
import android.os.Bundle;

public class hello extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.main);
		TextView tv = new TextView(this);
		tv.setText(“Hello, Android”);
		setContentView(tv);
	}
}
Finally:

Building a Joshfire application for Android

We provide you a base project. Open your configured Eclipse and create a new "Android Project" and select "create project from existing source".

Start from the base project
Indicate the joshfire/build/adapters/android/base-eclipse-project/joshfire-android-base. Then as above:
  1. check the targets Android 2.2 or Galaxy tab addon
  2. min SDK version is 8
  3. Edit android manifest.xml, set debuggable to true
Back in your project :
The javascript logs and errors in the Eclipse console