Sunday, January 10, 2010

[android-developers] keep webview in one activity

hi, folks.

Does some please let me know how to use webview?
I want to make a webview keep to work wthin in a layout without
opening new web browser when clicking a link tag.

For instance, you can see the "Hello" text and google web page on a
display. Then if you click the "help" or "news" or "settings" links,
the android boots new web window and shows the web page.

I want to keep/fix the webview to open web page. I dont want to start
android embedded web browser.
Does anyone know the way to do this??

<!-- sample code -->
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webview.loadUrl("http://www.google.co.jp/");

<!-- sample layout -->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<TextView
android:id="@+id/text_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dip"
android:text="Hello" />

<WebView
android:id="@+id/web_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"/>
</LinearLayout>


Thanks in advance

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate