I’m trying to create a custom TabHost. And I want to call the setTabSelectionListener() method of TabWidget.
But I have the following error:
TabWidget.OnTabSelectionChanged cannot be resolved to a type
Here is my test code:
public class CustomTabHost {
public CustomTabHost(Activity activity) {
TabWidget tab_widget = (TabWidget) activity.findViewById(R.id.tab_widget);
tab_widget.setTabSelectionListener(new TabWidget.OnTabSelectionChanged() {
public void onTabSelectionChanged(int tabIndex, boolean clicked) {
}
});
}
}
I’m using Eclipse and Android 2.2.
Thanks in advance!
Instead of using the setTabSelectionListener why dont you use the .OnchangeTabListener as shown : How to use TabHost.OnTabChangeListener in android?
Also in the part where it says //your code here … try calling a new class which extends Fragment and inflate the particular fragment with the menu !