我在應用程序中出現錯誤,當我到達列表視圖的末尾時崩潰。不知道是什麼導致了這個問題,以及如何解決這個問題。我使用遊標來填充我的列表視圖。這是我的代碼,我用來填充從列表視圖:當列表視圖到達列表末尾時出現錯誤/崩潰
How to assing an Image to Imageview based on a query results?
錯誤:
11-15 12:45:22.446: E/AndroidRuntime(276): FATAL EXCEPTION: main
11-15 12:45:22.446: E/AndroidRuntime(276): java.lang.NullPointerException
11-15 12:45:22.446: E/AndroidRuntime(276): at android.content.res.AssetManager.getResourceIdentifier(Native Method)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.content.res.Resources.getIdentifier(Resources.java:1422)
11-15 12:45:22.446: E/AndroidRuntime(276): at com.example.yao.zCustomUsersAdapter.getView(zCustomUsersAdapter.java:62)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.AbsListView.obtainView(AbsListView.java:1294)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.ListView.makeAndAddView(ListView.java:1727)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.ListView.fillDown(ListView.java:652)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.ListView.fillGap(ListView.java:623)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2944)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2485)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.os.Handler.handleCallback(Handler.java:587)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.os.Handler.dispatchMessage(Handler.java:92)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.os.Looper.loop(Looper.java:123)
11-15 12:45:22.446: E/AndroidRuntime(276): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-15 12:45:22.446: E/AndroidRuntime(276): at java.lang.reflect.Method.invokeNative(Native Method)
11-15 12:45:22.446: E/AndroidRuntime(276): at java.lang.reflect.Method.invoke(Method.java:521)
11-15 12:45:22.446: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-15 12:45:22.446: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-15 12:45:22.446: E/AndroidRuntime(276): at dalvik.system.NativeStart.main(Native Method)
zCustomUsersAdapter.java的第62行是什麼?你在那裏得到一個NPE。 – TronicZomB
那麼,zCustomeUserAdapter是我創建自定義列表視圖的類(其中包含一個imageview和2個textview)此類將從我的數據庫中將值分配給imageview和textview。 – user3128770