Thank you for the response. But like I said im very very new to this
and i was basically looking for an example. I wish i knew what you
meant and could go from there but if you dont mind could you show me
what it should look like? Thank you so much, hopefully from looking at
it i can get a better idea of the whole make a menu, then add buttons,
change the icons on the buttons, then make the buttons do things (like
in this case refresh the current page of a webview)
*****************************
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);
}
}
On Nov 5, 9:42 pm, Justin Anderson <[email protected]> wrote:
> Override the following methods in the Activity class:
> - onCreateOptionsMenu()
> - onPrepareOptionsMenu()
> - onOptionsItemSelected()
>
> http://developer.android.com/reference/android/app/Activity.html#onCr...
>
> Good luck,
> Justin
>
> ----------------------------------------------------------------------
> There are only 10 types of people in the world...
> Those who know binary and those who don't.
> ----------------------------------------------------------------------
>
>
>
> On Wed, Nov 4, 2009 at 8:51 PM, BryBam <[email protected]> wrote:
> > 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-beginners%2Bunsubscr
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en