Hi,

here you are my problem.
When user click "refresh" in OptionsMenu, disappear Tabhost and the
app
use the simple webbrowser out of app.
I'd like to use OptionMenu "refresh" inside tab host.
My code:
public class app extends TabActivity {
        @Override



        public void onCreate(Bundle savedInstanceState) {

                super.onCreate(savedInstanceState);

                TabHost host=getTabHost();
                Intent i=new Intent(this, CWBrowser.class);

                i.putExtra(CWBrowser.URL, "http://www.website.it/";);
                host.addTab(host.newTabSpec("one")
                                                .setIndicator("News")
                                                .setContent(i));

                //to update tab each time it pressed
                i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                i=new Intent(i);
                i.putExtra(CWBrowser.URL, "http://www.android.com";);
                host.addTab(host.newTabSpec("two")
                                                .setIndicator("Android")
                                                .setContent(i));
        }

        public boolean onCreateOptionsMenu(Menu menu){
                super.onCreateOptionsMenu(menu);
                Intent i=new Intent(this, CWBrowser.class);
                i.putExtra(CWBrowser.URL, "http://www.website.it/";);




                //We create the first group of MenuItem
                int GROUPA = 0;
                menu.add(GROUPA, 0, 0, "Refresh").setIntent(i);
                return true;


        }
}

AND CWBrowser
public class CWBrowser extends Activity {
        public static final String URL="it.app.android.URL";
        private WebView browser;

        @Override
        public void onCreate(Bundle icicle) {
                super.onCreate(icicle);

                browser=new WebView(this);
                setContentView(browser);
        browser.getSettings().setJavaScriptEnabled(true);
        browser.setWebViewClient(new HelloWebViewClient());
                browser.loadUrl(getIntent().getStringExtra(URL));

        }

        private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String
url) {
            view.loadUrl(url);
            return true;
        }
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to