문제

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

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top