Click Here to download Source Code
Package Name : selva.web
Project Name : WebView
Version : 1.5 ( Supports 1.5 and above versions)
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView
android:id="@+id/webview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView
android:id="@+id/webview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
WebViewActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class WebViewActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv = (WebView) findViewById(R.id.webview1);
final String mimeType = "text/html";
final String encoding = "UTF-8";
String html = "<H1>A simple HTML page</H1><body>" + "<p>Android tutorial programs present in www.androidprogramz.in</p>";
wv.loadDataWithBaseURL("", html, mimeType, encoding, "");
}
}
OUTPUT :
Click Here to download Source Code
Hello,
ReplyDeleteI have a question regarding webview
I have a shopping cart application.When user select a product next page will show product detail with a button of shop.When user clicks that button it will open this in a URl which in outside application but i want open this within our app using webview where URL will show show.
URLs are coming from a xml in server.
Please do you have any solution for this.
Please reply and thank you.
Hi Hello Sir,
ReplyDeleteMy name is Amit Bhaliya i m developing a mobile android app but i have some problem is there.the problem is that how to put hyperlink in my code so please help to me send me your email id then i will send you my code please help to me.
Thanking You.
Amit Bhaliya
Android Developer