On my Main activity:
button = (Button) findViewById(R.id.mainAddWatchButton);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(audiovideo, CountyBrowser.class));
}
});
CountyBrowser activity starts fine (and behaves fine, just as it should), but things like these spews out in LogCat:
10-11 19:10:41.182: INFO/ActivityManager(58): Starting activity: Intent { cmp=se.ribit.bb/.CountyBrowser }
10-11 19:10:41.782: DEBUG/dalvikvm(368): GC freed 6313 objects / 354184 bytes in 114ms
10-11 19:10:41.812: INFO/dalvikvm(368): Uncaught exception thrown by finalizer (will be discarded):
10-11 19:10:41.812: INFO/dalvikvm(368): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d3ec38 on null that has not been deactivated or closed
10-11 19:10:41.823: INFO/dalvikvm(368): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
10-11 19:10:41.823: INFO/dalvikvm(368): at dalvik.system.NativeStart.run(Native Method)
10-11 19:10:41.852: INFO/dalvikvm(368): Uncaught exception thrown by finalizer (will be discarded):
10-11 19:10:41.862: INFO/dalvikvm(368): Ljava/lang/IllegalStateException;: **Finalizing cursor android.database.sqlite.SQLiteCursor@43d3dc80 on null that has not been deactivated or closed**
10-11 19:10:41.862: INFO/dalvikvm(368): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
10-11 19:10:41.873: INFO/dalvikvm(368): at dalvik.system.NativeStart.run(Native Method)
10-11 19:10:42.452: INFO/ActivityManager(58): Displayed activity se.ribit.bb/.CountyBrowser: 1198 ms (total 1198 ms)
10-11 19:10:47.702: DEBUG/dalvikvm(206): GC freed 124 objects / 5424 bytes in 154ms
10-11 19:10:52.692: DEBUG/dalvikvm(105): GC freed 2292 objects / 133288 bytes in 107ms
I am using database and cursors, but the messages above contains zero information whether I’m doing something wrong or not. The activity works fine, except for these logs. If I run everything in debug-mode, the emulator throws me back to Eclipse all the time.
Am I missing something here? Anyone care for a guess of what I’m doing wrong?
I think you have to close the cursors before the Activity pauses. In your onPause method for the Activity that opens the new Activity, try closing the cursors.