Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

Hi,

I want to work with webview now and i cant seem to find any tutorials. im looking to just do a make a textbox navigate the webview to a website.

here is my view xml if this helps

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/linearLayout1" />

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="60dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:removed="@drawable/actionbar" >

        <Button
            android:id="@+id/button1_back"
            android:layout_width="42dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text="<" />

        <Button
            android:id="@+id/button3_forward"
            android:layout_width="41dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text=">" />

        <EditText
            android:id="@+id/editText1_url"
            android:layout_width="124dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="0.64"
            android:ems="20"
            android:inputType="textEmailAddress" >

            <requestFocus />
        </EditText>

        <Button
            android:id="@+id/button2navigate"
            android:layout_width="48dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:text="Go" />
    </LinearLayout>

</RelativeLayout>

any help would be good!

Thanks
Posted

1 solution

HTML
EditText url;

url=(EditText) findViewById(R.id.editText_password);

inside btn click event
HTML
WebView page=(WebView)findVieById(R.Id.webview1);
page.loadUrl(url);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900