Many users of my programs report "Force Close" with the same error, and I cannot reproduce the error, so it is difficult to debug it!
This seems to be due to TabHost (Ive got two in my application)
Ive currently trying to extend TabHost by overriding dispatchWindowFocusChanged () and testing if getCurrentView () returns null ... if so, I set CurrentTab () to the last known tab index. But I don't know if this will do the trick ...
Is there any information about this report?
java.lang.NullPointerException
at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:298)
at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:302)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1946)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
And here is the TabHost layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/main_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/airport_linear"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
</LinearLayout>
source
share