什么是这个例外?

时间:2011-12-31 01:10:25

标签: java android exception exception-handling

我有一个从主要活动调用的活动(BookMarks)。 BookMarks抛出一个异常(并不是所有的时间)我无法弄清楚这个异常意味着什么。

I/ActivityManager(  181): START {cmp=com.unreal.muslim/.BookMarks} from pid 25558
I/WindowManager(  181): createSurface Window{41fbf070 Loading...  paused=false}: DRAW NOW PENDING
I/WindowManager(  181): createSurface Window{41da2230 com.unreal.muslim/com.unreal.muslim.BookMarks paused=false}: DRAW NOW PENDING
E/bm run catch(25558): Only the original thread that created a view hierarchy can touch its views.
D/AndroidRuntime(25558): Shutting down VM
W/dalvikvm(25558): threadid=1: thread exiting with uncaught exception (group=0x40a5d1f8)
E/AndroidRuntime(25558): FATAL EXCEPTION: main
E/AndroidRuntime(25558): java.lang.NullPointerException
E/AndroidRuntime(25558):        at android.widget.AbsListView$RecycleBin.getScrapView(AbsListView.java:5900)
E/AndroidRuntime(25558):        at android.widget.AbsListView.obtainView(AbsListView.java:2003)
E/AndroidRuntime(25558):        at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
E/AndroidRuntime(25558):        at android.widget.ListView.onMeasure(ListView.java:1155)
E/AndroidRuntime(25558):        at android.view.View.measure(View.java:12603)
E/AndroidRuntime(25558):        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
E/AndroidRuntime(25558):        at android.view.View.measure(View.java:12603)
E/AndroidRuntime(25558):        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
E/AndroidRuntime(25558):        at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
E/AndroidRuntime(25558):        at android.view.View.measure(View.java:12603)
E/AndroidRuntime(25558):        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
E/AndroidRuntime(25558):        at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
E/AndroidRuntime(25558):        at android.view.View.measure(View.java:12603)
E/AndroidRuntime(25558):        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4677)
E/AndroidRuntime(25558):        at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
E/AndroidRuntime(25558):        at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2072)
E/AndroidRuntime(25558):        at android.view.View.measure(View.java:12603)
E/AndroidRuntime(25558):        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1044)
E/AndroidRuntime(25558):        at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418)
E/AndroidRuntime(25558):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(25558):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(25558):        at android.app.ActivityThread.main(ActivityThread.java:4340)
E/AndroidRuntime(25558):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(25558):        at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(25558):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(25558):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(25558):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  181):   Force finishing activity com.unreal.muslim/.BookMarks
W/ActivityManager(  181):   Force finishing activity com.unreal.muslim/.main

任何人都可以帮我理解这个例外以及修复它的可能解决方案吗?

1 个答案:

答案 0 :(得分:3)

我认为这是你的问题

E/bm run catch(25558): Only the original thread that created a view hierarchy can touch its views.

您在哪里为ListView设置适配器?另外,您可以在活动中发布代码吗?