Question

When i come back from tab 1 with saving data and come on the my main tab activity so i come on the current tab 0 so how can i come back with my last updated tab activity ?

Thanks

Was it helpful?

Solution

You can use SharedPreferences At load time

step 1 at load time Write SharedPreferences and store 0 values make sure its write one time

step 2 Read that values from SharePreference and getting it

stap 3 set values in like

 Boolean temp = true;

if(temp)
    {
         SharedPreferences.Editor shedit=shreftab.edit();
         shedit.putString("tabchange", "0");
         shedit.commit();
         temp = false;
    }

         String  vartabis = shreftab.getString("tabchange", null);
         tabhost.setCurrentTab(Integer.parseInt(vartabis));

step 4 now you can update it SharedPreferences file key values as per require and get it

OTHER TIPS

you can use the "SharedPreferences".

You need to store one variable in the shared prefrence with the last updated tab name or id or index whatever. then when coming back you need to check this variable that what was last tab and there do some stuff to go to that tab.

Here are some of the demo links regarding this.

Demo-1

Demo-2

Demo-3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top