2 u012288835 u012288835 于 2013.11.06 01:03 提问

listview在下拉的时候会强行退出程序

RT。
在下拉到listview底端的时候,程序会自动退出。
我不知道是listview用错了还是我其他代码写得不对了。求出高手:
显示错误为

 11-05 11:16:06.785: E/AndroidRuntime(955): FATAL EXCEPTION: main
11-05 11:16:06.785: E/AndroidRuntime(955): java.lang.NullPointerException
11-05 11:16:06.785: E/AndroidRuntime(955):  at cn.edu.uibe.brainstorming.SecondActivity.checkRoom(SecondActivity.java:117)
11-05 11:16:06.785: E/AndroidRuntime(955):  at cn.edu.uibe.brainstorming.SecondActivity.access$4(SecondActivity.java:107)
11-05 11:16:06.785: E/AndroidRuntime(955):  at cn.edu.uibe.brainstorming.SecondActivity$2.onClick(SecondActivity.java:81)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.view.View.performClick(View.java:4240)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.view.View$PerformClick.run(View.java:17721)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.os.Handler.handleCallback(Handler.java:730)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.os.Looper.loop(Looper.java:137)
11-05 11:16:06.785: E/AndroidRuntime(955):  at android.app.ActivityThread.main(ActivityThread.java:5103)
11-05 11:16:06.785: E/AndroidRuntime(955):  at java.lang.reflect.Method.invokeNative(Native Method)
11-05 11:16:06.785: E/AndroidRuntime(955):  at java.lang.reflect.Method.invoke(Method.java:525)
11-05 11:16:06.785: E/AndroidRuntime(955):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-05 11:16:06.785: E/AndroidRuntime(955):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-05 11:16:06.785: E/AndroidRuntime(955):  at dalvik.system.NativeStart.main(Native Method)
11-05 11:20:28.564: E/AndroidRuntime(1030): FATAL EXCEPTION: main
11-05 11:20:28.564: E/AndroidRuntime(1030): java.lang.NullPointerException
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.AbsListView.obtainView(AbsListView.java:2177)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ListView.makeAndAddView(ListView.java:1840)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ListView.fillDown(ListView.java:675)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ListView.fillFromTop(ListView.java:736)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.ListView.layoutChildren(ListView.java:1655)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.AbsListView.onLayout(AbsListView.java:2012)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.View.layout(View.java:14289)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewGroup.layout(ViewGroup.java:4559)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1976)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1730)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.Choreographer.doCallbacks(Choreographer.java:562)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.Choreographer.doFrame(Choreographer.java:532)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.os.Handler.handleCallback(Handler.java:730)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.os.Looper.loop(Looper.java:137)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at android.app.ActivityThread.main(ActivityThread.java:5103)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at java.lang.reflect.Method.invokeNative(Native Method)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at java.lang.reflect.Method.invoke(Method.java:525)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-05 11:20:28.564: E/AndroidRuntime(1030):     at dalvik.system.NativeStart.main(Native Method)

2个回答

franzhong
franzhong   2013.11.06 10:46

getView里有个空指针,检查一下

sasuke38
sasuke38   2013.11.07 14:50

SecondActivity.java该类的第117行代码中使用的某个变量可能是空值

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!