Tuesday, November 15, 2011

[android-developers] TabWidget NullPointerException in pre-Froyo

Hi!
I've done a simple TabActivity that loads several Intents into the
tabs. It works fine in Froyo or later but gives this error on older
versions:

E/AndroidRuntime( 1958): java.lang.NullPointerException
E/AndroidRuntime( 1958): at
android.widget.TabWidget.dispatchDraw(TabWidget.java:173)

This happens even with an empty OnCreate method:

public class MyTabHost extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.mycustomtab);
}

mycustomtab.xml:
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="@android:id/tabhost"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@android:id/
tabcontent" android:layout_weight="1" />
<TabWidget android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@android:id/tabs"
android:layout_weight="0"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-5px" />
</LinearLayout>
</TabHost>

-----------------------

I did a quick search and found other developers with the same problem
but it seems no-one has found a solution to this problem (possible bug
in Android?).
Can anyone help? Thanks in advance!

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate