Q:

Uncaught exception thrown by finalizer (will be discarded) , Android

In logcat I found these messages, my application runs correctly (No error/ No exception/ and correct result), but why these messages appears in log cat. I closed all cursors. And one more thing, Application goes a little bit slow to displaying activity( Which activity is listed in my logcat message), I think it takes that time to generate these log messages. What is solution for this.
I/ActivityManager(   63): Starting activity: Intent { cmp=com.pankaj.myapp/.SelectedContactActivity (has extras) }
    D/dalvikvm(  251): GC freed 2584 objects / 174064 bytes in 139ms
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d2c688 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d2bf58 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d2b5a8 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d29af0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d293c0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d28a28 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d26f70 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d26808 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d25e60 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d24310 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d23be0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d23238 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d21780 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d21028 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d20688 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1ebd0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1e480 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1dae0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1bfa0 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1b760 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/dalvikvm(  251): Uncaught exception thrown by finalizer (will be discarded):
    I/dalvikvm(  251): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43d1ac40 on contacts_tags that has not been deactivated or closed
    I/dalvikvm(  251):  at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
    I/dalvikvm(  251):  at dalvik.system.NativeStart.run(Native Method)
    I/ActivityManager(   63): Displayed activity com.pankaj.myapp/.SelectedContactActivity: 2245 ms (total 2245 ms)

Caller Activity is using List View, And after clicking of list item "SelectedContactActivity" activity calls.
In caller Activity
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.contacts_list_item);
        SimpleAdapter contactAdapter = getAdapter(); // This method returns SimpleAdapter object 
       // Bind to our new adapter.
       setListAdapter(contactAdapter);
    }

protected void onListItemClick(ListView l, View view, int position, long id) {
        super.onListItemClick(l, view, position, id);

        Intent intent = new Intent().setClass(this, AddModifyTag.class);
        intent.putExtra("_id",contactInfo.get("_id"));
        intent.putExtra("name", contactInfo.get("name"));
        intent.putExtra("number", contactInfo.get("number"));
        intent.putExtra("position", position);
        this.startActivityForResult(intent, EDIT_CONTACT_TAGS);
    }

On called Activity
public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
......
......
        Cursor tags;
        db.open();
        tags = db.getContactTags(contactID);
        startManagingCursor(tags);
        .......
        .......
        db.close();
}

A:

I think you are getting this error because you did not close the Cursor in onStop() or onDestroy(). Try to close the Cursor. You can also use startManagingCursor() for you Cursor which will help you  to close the Cursor by Android.

