2012年8月28日 星期二

[Android] Use Webview class to develop WEB App



If you want to deliver a web application as a part of a client App, can use WebView. The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout.
It does not include any features of a fully developed web browser, such as navigation controls or an address bar.

The demo code as below:

1. Import the Web View class
import android.webkit.WebView;  

2. Declass Web View and use loadUrl
WebView webView = new WebView(this);
webView.loadUrl("http://your web site");
setContentView(webView);

3. Also need to add permission to access your Internet.
Add permission setting at androidmanifest.xml 
<uses-permission android:name="android.permission.INTERNET" />

4. Develop web and make layout similar to Android App.


沒有留言:

張貼留言