-1

my english is too bad.. so if my question is some strange.. understand me..

first current ui using a preference for setting. by the way menu depth is too deep.. so if user want to go first menu, he click the too many back button.

so i am used TabHost and each tab shows a list(using a preference tag) but if user click the list item , tab is disappear and shows only preference ui.

how can i use a Tab with preference ?

carygun
  • 1
  • 1

1 Answers1

0

Preferences by default do not have tab support. So you would need to write that yourself.

Basically on each tab you inflate and use a different preferences.xml file, that all together form the whole preferences you need to set:

public class Preferences extends PreferenceActivity {

    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.preferences); // <<-- here
    }

And then either depending on the tab create different Preferences activities or pass the name of the file to instantiate in the constructor, so you only need one class to handle this.

Heiko Rupp
  • 30,426
  • 13
  • 82
  • 119
  • thanks.. ur solution is 50% right.. but next action is problem. if user click the item that each tab had a preference list then tab is disappear and shows only preference list item. – carygun Apr 29 '11 at 11:09
  • if preference structure is like this ur solution shows list but if user click the first item then ui shows only b/c list without tab... so i want to know what using a tab with preference...pleaze~~ – carygun Apr 29 '11 at 11:15