用于ListView图标的ArrayAdapter崩溃应用程序

时间:2012-11-05 01:00:48

标签: listview crash android-arrayadapter logcat

我对Android开发非常新,几乎没有经验。但是,我查找了如何在列表视图中获取文本旁边的图标的教程。我按照教程,在没有错误后,启动了我的应用程序。当我点击任何按钮,甚至是不受arrayadapter影响的按钮时,应用程序崩溃了。

这是ArrayAdapter代码

http://pastebin.com/2GQn4Ugr

以下是显示listview的.class文件的代码

http://pastebin.com/mWU6UWLv

最后,这是logcat

11-04 16:59:02.492: E/AndroidRuntime(28578): FATAL EXCEPTION: main
11-04 16:59:02.492: E/AndroidRuntime(28578): java.lang.NullPointerException
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:392)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.AbsListView.obtainView(AbsListView.java:2451)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ListView.makeAndAddView(ListView.java:1780)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ListView.fillDown(ListView.java:678)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ListView.fillFromTop(ListView.java:738)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.ListView.layoutChildren(ListView.java:1631)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.AbsListView.onLayout(AbsListView.java:2281)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.View.layout(View.java:11338)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewGroup.layout(ViewGroup.java:4238)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.View.layout(View.java:11338)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewGroup.layout(ViewGroup.java:4238)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1644)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1502)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1415)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.View.layout(View.java:11338)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewGroup.layout(ViewGroup.java:4238)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.View.layout(View.java:11338)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewGroup.layout(ViewGroup.java:4238)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1667)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2624)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.os.Looper.loop(Looper.java:137)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at android.app.ActivityThread.main(ActivityThread.java:4517)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at java.lang.reflect.Method.invokeNative(Native Method)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at java.lang.reflect.Method.invoke(Method.java:511)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
11-04 16:59:02.492: E/AndroidRuntime(28578):    at dalvik.system.NativeStart.main(Native Method)

谢谢:D

0 个答案:

没有答案