Jumat, 28 Oktober 2016

Android Tutorial-Simple-Android-PhoneGap-ExampleANDROIDKAWE

Simple Android Phone Gap Application Example

Hi Friend
           We know that Phone Gap  provide facility to create Hybrid (cross plat form) application. In phonegap we create application using HTMLt5, CSS3 and JavaScript.
            Now i am going to explain how to create simple android phone gap exaple application using eclipse IDE.


Step 1: First of all download phonegap SDK and extract Director structure like this.


click on lib

click on andorid
 


Now create an android application:

                              1. create www name folder in assets folder.
                              2. create index.html file with www folder that created previously.
                              3. Copy from \phonegap-2.3.0\lib\android\ cordova-2.3.0.js file and patse in www folder.
                               4.Copy from \phonegap-2.3.0\lib\android\cordova-2.3.0.jar file and paste in project lib folder and add to build path.
                               5. Copy from \phonegap-2.3.0\lib\android\xml folder and paste it into res folder.


Now your project file directory structure look like this.



Now open your java file and write code like this:


package in.android.androidphonegapexample;

import org.apache.cordova.DroidGap;

import android.os.Bundle;

public class MainActivity extends  DroidGap {

  

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }

   

Now open your application manifest.xml file and add these code.


add these code in activity tag android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"

Now Run Your application you got out put like this:-




You can down load complete code here





Previous Post
Next Post

0 komentar: