First Create Simple Android Project(webapp).
We need WebView in xml for Develop WebApp in Android . So Following Step are Create simple WebApp in android.
1) res/layout/main.xml
paste following code in main.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
2)webapp.java
following Activity is open google.com page in webview.
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import org.apache.cordova.*;
public class webapp extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wb = (WebView)findViewById(R.id.webview);
wb.loadUrl("http://www.google.com");
}
}
3) Run the Above Application and output is.
We need WebView in xml for Develop WebApp in Android . So Following Step are Create simple WebApp in android.
1) res/layout/main.xml
paste following code in main.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
2)webapp.java
following Activity is open google.com page in webview.
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import org.apache.cordova.*;
public class webapp extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wb = (WebView)findViewById(R.id.webview);
wb.loadUrl("http://www.google.com");
}
}
3) Run the Above Application and output is.
this code is not run in my application ?
ReplyDeletewhat can i do ?
Add following file in AndroidManifest.xml
DeleteAbove Application Tag.
uses-permission android:name="android.permission.INTERNET"