Dear All,

Is there some workaround for a null pointer exception
in TabWidget. It basically happens in the following code:

        tabHost.clearAllTabs();
        tabHost.addTab(spec);

The clearAllTabs sets the mSelectedTab to -1. The problem is
some sloppy code in the Android 2.3.7 version of TabWidget:

337    public void  setCurrentTab(int index) {
[...]
342        getChildTabViewAt(mSelectedTab).setSelected(false);

The crash is in 342 since getChildTabViewAt returns null
when mSelectedTab == -1.

This was fixed in the Android 4.0.3 version or maybe before
of TabWidget:

386    public void  [More ...] setCurrentTab(int index) {
[...]
391        if (mSelectedTab != -1) {
392            getChildTabViewAt(mSelectedTab).setSelected(false);
393        }

How would one go about to workaround the problem in Android 2.3.7?

Bye


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to