PhoneGap App with Android using Eclipse. If you have some basic knowledge of HTML, CSS and JavaScript you can build the app within a few minutes.
To do this you need the followings :
Now open index.html file and add the following code
Now open AndroidManifest.xml (HelloWorld/AndroidManifest.xml - Right click on AndroidManifest.xml > Open With > Text Editor) and add the following code
Now how to run the app
Right click on your project i.e HelloWorld (NOTE : Before that make sure you have created an Android Virtual Device Manager. To create an AVD please go to the following link https://developer.android.com/tools/devices/managing-avds.html and follow the steps) then click on Run As and then click on Android Application.
Hi all! Today I want to show you, how to create Hello World - Eclipse : https://www.eclipse.org/downloads/packages/eclipse-mobile-developers/junosr2 (NOTE : If you donot have Java in your machine please install jdk and jre from https://docs.oracle.com/javase/7/docs/webnotes/install/ or https://www.oracle.com/technetwork/java/javase/downloads/index.html)
- Android SDK : https://developer.android.com/sdk/index.html
- PhoneGap : https://phonegap.com/download/
Now click on Next button and follow the bellow picture sequence
Now click on Finish button.
Configure this project with PhoneGap :
First add a new folder called www inside assets folder (assets/www) and inside the www folder add a new file called index.html (Right click on assets folder > New > Folder > Folder Name : www and then Right click on www > New > File > File Name : index.html)
Now extract phonegap-2.7.0.zip and go to /phonegap-2.7.0/lib/android/ folder and
- Copy cordova-2.7.0.jar and paste it to libs folder within your Android project.
- Copy cordova-2.7.0.js to www folder within your Android project.
- Copy the xml folder to res folder within your Android project. (See the picture below)

Now open index.html file and add the following code
Now go to open MainActivity.java (HelloWorld > src > com.mayukh.helloworld > MainActivity.java) and add the following code
package com.mayukh.helloworld;
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class MainActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
See the picture below
Now open AndroidManifest.xml (HelloWorld/AndroidManifest.xml - Right click on AndroidManifest.xml > Open With > Text Editor) and add the following code
See the picture below 
Now how to run the app
Right click on your project i.e HelloWorld (NOTE : Before that make sure you have created an Android Virtual Device Manager. To create an AVD please go to the following link https://developer.android.com/tools/devices/managing-avds.html and follow the steps) then click on Run As and then click on Android Application.

No comments:
Post a Comment