org.solovyev.android
Class LastTabSaver

java.lang.Object
  extended by org.solovyev.android.LastTabSaver
All Implemented Interfaces:
android.widget.TabHost.OnTabChangeListener

public class LastTabSaver
extends Object
implements android.widget.TabHost.OnTabChangeListener

This class saves the last opened tab in the tabHost to the SharedPreferences in order to reopen it after closing The tab is defined by it's tab id and tab activity where it is hold => you can use the same tab ids in different tab activities


Constructor Summary
LastTabSaver(android.app.TabActivity tabActivity, String defaultTabId)
          Constructor applies saved preference value on tabHost returned by android.app.TabActivity#getTabHost() method and registers as onTabChangeListener
 
Method Summary
 void destroy()
          Method must be invoked on android.app.Activity#onDestroy() method of tab activity
 String getLastOpenedTabId()
           
 void onTabChanged(String tabId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LastTabSaver

public LastTabSaver(@Nonnull
                    android.app.TabActivity tabActivity,
                    @Nonnull
                    String defaultTabId)
Constructor applies saved preference value on tabHost returned by android.app.TabActivity#getTabHost() method and registers as onTabChangeListener

Parameters:
tabActivity - tab activity
defaultTabId - default tab (if no preference value is not defined)
Method Detail

destroy

public void destroy()
Method must be invoked on android.app.Activity#onDestroy() method of tab activity


onTabChanged

public void onTabChanged(String tabId)
Specified by:
onTabChanged in interface android.widget.TabHost.OnTabChangeListener

getLastOpenedTabId

@Nonnull
public String getLastOpenedTabId()


Copyright © 2014 se.solovyev. All Rights Reserved.