Why some code on Samsung Galaxy S does not work?
I am writing an application for Android devices.
After finishing the development and testing the program, I find that the following NullPointerException is thrown only on the Samsung Galaxy S. The application does not have this problem on other Android devices.
The error message captured in logcat is,
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): java.lang.NullPointerException
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:298)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:302)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.widget.TabHost.dispatchWindowFocusChanged(TabHost.java:302)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:662)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at and开发者_Go百科roid.view.ViewRoot.handleMessage(ViewRoot.java:1921)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.os.Handler.dispatchMessage(Handler.java:99)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.os.Looper.loop(Looper.java:123)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at java.lang.reflect.Method.invokeNative(Native Method)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at java.lang.reflect.Method.invoke(Method.java:521)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
05-06 09:09:15.919: ERROR/AndroidRuntime(10657): at dalvik.system.NativeStart.main(Native Method)
It has not pointed out which line in my source code causes the problem. I checked the TabHost object and it is not null.
Could anyone give me some idea to solve it? Thanks a lot.
精彩评论