在这一点上,我很沮丧.我已经研究了几天,甚至无法隔离任何超出游标问题的东西.我正在扩展ListActivity并在OnCreate方法中使用startManagingCursor(newcursor).这是在按下主页按钮时运行和崩溃的代码(数据库已经填满):
private void loadAlbums() {
try {
newcursor = mDbHelper.getAlbumTitlesCursor();
dbalbumadapter = new AlbumListCursorAdapter(this, newcursor);
setListAdapter(dbalbumadapter);
}
catch (SQLiteException s) {
newcursor = null;
fetchalbums = new FetchAlbumsTask().execute();
}
current_view = ALBUMTITLE_VIEW;
}
Run Code Online (Sandbox Code Playgroud)
这是错误日志:
02-03 13:41:42.379: WARN/dalvikvm(340): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
02-03 13:41:42.389: ERROR/AndroidRuntime(340): Uncaught handler: thread main exiting due to uncaught exception
02-03 13:41:42.590: ERROR/AndroidRuntime(340): java.lang.RuntimeException: Unable to stop activity {com.skip.ngRCv2/com.skip.ngRCv2.ngRC}: java.lang.RuntimeException: Unable to stop activity {com.skip.ngRCv2/com.skip.ngRCv2.MusicLibraryActivity}: java.lang.NullPointerException
02-03 13:41:42.590: ERROR/AndroidRuntime(340): at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3227)
02-03 13:41:42.590: ERROR/AndroidRuntime(340): …Run Code Online (Sandbox Code Playgroud) android cursor nullpointerexception listactivity runtimeexception