Hey guys, i'm very new to this. I only have basic XHTML knowledge and
im looking into getting more into android development so ive been
reading the tutorials but i cant find a tutorial on how to create a
menu and then make the menu button refresh my webview content.
anyone...here's my current code. i was wondering if someone could show
me how it should look to make it when i hit the menu button and then
how to make the menu button do a refresh of my web content. thanks in
advance i think getting to look how it is done may help me understand
a lot of whats been confusing me ive looked everywhere and i just get
lost.

*****************************
my code:
webview.java -
*****************************
package com.brybam.webview;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class webview extends Activity {
        /** Called when the activity is first created. */
        WebView webview;
        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        webview = (WebView) findViewById(R.id.webview);
        webview.setWebViewClient(new webviewClient());
        webview.getSettings().setJavaScriptEnabled(true);
        webview.loadUrl("http://google.com";);
    }
        private class webviewClient extends WebViewClient {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view,
String url)
{
                view.loadUrl(url);
                return true;
            }
        }
        public boolean onKeyDown(int keyCode, KeyEvent event) {
            if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack
()) {
                webview.goBack();
                return true;
            }
            return super.onKeyDown(keyCode, event);
        }
}


*****************************
main.xml -
*****************************
<?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">
    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    />

</LinearLayout>


*****************************
AndroidManifest.xml -
*****************************
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.brybam.webview"
      android:versionName="3" android:versionCode="3">
    <application android:icon="@drawable/icon"
android:theme="@android:style/Theme.NoTitleBar">
        <activity android:name=".webview"
                  android:label="@string/app_name"
                  android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>





-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to