Use tabHost.getTabWidget().setDividerDrawable(null);
instead of R.drawable.empty_divider
.
Reasoning:
Looking at the stacktrace and the Android 2.2 source for TabWidget.java, there seems to be an issue in the getChildTabViewAt(int index)
method where if the dividerDrawable is not null, it skips over the divider views in the tab bar to get the actual tabview.
public View getChildTabViewAt(int index) {
// If we are using dividers, then instead of tab views at 0, 1, 2, ...
// we have tab views at 0, 2, 4, ...
if (mDividerDrawable != null) {
index *= 2;
}
return getChildAt(index);
}
I think what happens when you use R.drawable.empty_divider
for the dividerDrawable the divider views don't get drawn, so they should be treated as if they were null
. As you can see, that doesn't happen, so that would explain the NullPointerException and the strange behaviour where you click one tab and it selects another.