Let’s assume that we’ve installed all the needed software as described in :
Now we open the Eclipse :
File –> New –> Android Project
now will add the project definitions
When you choose Android 2.2 automatically Min SDK Version defined as 8
Package should be with two parts – package name and project name
Next –> Finish
Open new folders libs and assets\www
Go to phonegap source and get the phonegap.0.9.6 jar and js files.
jar goes to libs
js goes to assets\www
Now we’ll add the phonegap library to the project so:
Right click on jar file –> build path –> add to build path
Afterwards you can see the referenced library added to the solution :
Now we can reference it in code .
Go to src –> Pack.MyTest –> MyTestActivity.java –>
Add import and change extending :
Original Source:
package Pack.MyTest;
import android.app.Activity;
import android.os.Bundle;
public class MyTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Changed adding phonegap and extending from Droid and add the start page :
package Pack.MyTest;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.*;
import com.phonegap.*;
public class MyTestActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
///add the start page
super.loadUrl("file:///android_asset/www/index.html");
setContentView(R.layout.main);
}
}
Add to assets\www index.html start page as promissed :
(put the reference to phonegap.js inside)
Define the properties of the runner AVD :
Define what project you want to run :
Go to Right click MyTest –> Run as –> Android Application
Our Android application :
Go to your VS 2010 and open WebSite
Find your workspace for eclipse –> Open :
Work with VS – > JQM