Refresh button, out of tabhost

by satie » Wed, 05 Jan 2011 03:46:00 GMT


Sponsored Links
 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;
        }
        }
}

-- 



Other Threads

1. NGE CLICK TOMBOL HOME (BERMASALAH)

bro bro....

jadi gini om...

kan asalnya kalo pencet tombol home tuh ada 2 pilihan....

mau masuk ke home utama ato lock...

nah saya pencet lock....dengan nge checklist "ALWAYS"

nah ternyata salah,seharusnya tuh pilihnya Home (MENU UTAMA)...

sekarang kalo pencet Home selalu ngelock....

nah cara ngerubahnya lagi suapaya ada 2 pilihan lagi gimana yah?

ato nge balikin lagi supaya default lagi....

TOLONG LONG LONG

qiqiqiqiiqiiq

-- 
"Indonesian Android Community [id-android]" 

2. Android activity's memory management

Hello guys,
I have a problem with my application, and it's about a Virtual memory
error:
ERROR/AndroidRuntime(19790): java.lang.OutOfMemoryError: bitmap size
exceeds VM budget

The story is like this:
I have an activity (let's call it A), the user click on a button from
this activity, then i will make an api call somewhere in the internet,
and after the result is back i start a subactivity (let's call it B).

In the activity B i have to dinamicaly load some images from the
resources folder. I load the images into bitmaps -> drawables ->
imageviews. After the user click's on some buttons i have to
setResult(..), finish(), and get back to activity A.

The thing is that, goes from activity A to B, then B -> A, then A -> B
for a few times, my app crashes with the message above: it doesn't
have enough memory to load the interface.

I can not maintain the activity B on the stack because i don't want
the user to go to this activity without going through activity A
first.

Do you guys have any solution for this problem ?
Thanks

-- 

3. Alert Dialog to display across activities?

4. File upload in background: thread/service/AIDL...?

5. File upload in background: thread/service/AIDL...?

6. Variable in getResources().getStringArray

7. Invalid statement in fillWindow()