'Uncaught exception thrown by finalizer' when opening MapActivity
Asked Answered
K

3

8

I have these lines in my code:

// create tab4
intent = new Intent(this, ActWhereAmI.class)
        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
tabspecWhereAmI = tabHost
        .newTabSpec("tab4")
        .setIndicator(Utilities.prepareTabView(this,"where am I"))
        .setContent(intent);
tabHost.addTab(tabspecWhereAmI);


public static View prepareTabView(Context context, String text) {
        View view = LayoutInflater.from(context).inflate(
                R.layout.tab_indicator, null);
        TextView tv = (TextView) view.findViewById(R.id.tabIndicatorTextView);
        tv.setText(text);

        return view;
    }

When the application runs the line tabHost.addTab(tabspecWhereAmI); I get the following error only in LogCat and the program runs without any problem:

10-17 13:38:01.164: W/MapActivity(4815): Recycling dispatcher android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@413c8658
10-17 13:38:01.171: V/MapActivity(4815): Recycling map object.
10-17 13:38:01.335: W/MapActivity(4815): Recycling dispatcher android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher@413c8658
10-17 13:38:01.335: V/MapActivity(4815): Recycling map object.
10-17 13:38:01.554: D/dalvikvm(4815): GC_CONCURRENT freed 776K, 23% free 10286K/13255K, paused 2ms+7ms
10-17 13:38:01.554: E/System(4815): Uncaught exception thrown by finalizer
10-17 13:38:01.554: E/System(4815): java.lang.IllegalStateException: Binder has been finalized!
10-17 13:38:01.554: E/System(4815):     at android.os.BinderProxy.transact(Native Method)
10-17 13:38:01.554: E/System(4815):     at android.database.BulkCursorProxy.close(BulkCursorNative.java:288)
10-17 13:38:01.554: E/System(4815):     at android.database.BulkCursorToCursorAdaptor.close(BulkCursorToCursorAdaptor.java:133)
10-17 13:38:01.554: E/System(4815):     at android.database.CursorWrapper.close(CursorWrapper.java:49)
10-17 13:38:01.554: E/System(4815):     at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1591)
10-17 13:38:01.554: E/System(4815):     at android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:1604)
10-17 13:38:01.554: E/System(4815):     at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182)
10-17 13:38:01.554: E/System(4815):     at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
10-17 13:38:01.554: E/System(4815):     at java.lang.Thread.run(Thread.java:856)
10-17 13:38:01.554: E/System(4815): Uncaught exception thrown by finalizer
10-17 13:38:01.554: E/System(4815): java.lang.IllegalStateException: Binder has been finalized!
10-17 13:38:01.554: E/System(4815):     at android.os.BinderProxy.transact(Native Method)
10-17 13:38:01.554: E/System(4815):     at android.database.BulkCursorProxy.close(BulkCursorNative.java:288)
10-17 13:38:01.554: E/System(4815):     at android.database.BulkCursorToCursorAdaptor.close(BulkCursorToCursorAdaptor.java:133)
10-17 13:38:01.554: E/System(4815):     at android.database.CursorWrapper.close(CursorWrapper.java:49)
10-17 13:38:01.554: E/System(4815):     at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1591)
10-17 13:38:01.554: E/System(4815):     at android.content.ContentResolver$CursorWrapperInner.finalize(ContentResolver.java:1604)
10-17 13:38:01.554: E/System(4815):     at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182)
10-17 13:38:01.554: E/System(4815):     at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
10-17 13:38:01.554: E/System(4815):     at java.lang.Thread.run(Thread.java:856)

This exception occurs before the onCreate(...) method of ActWhereAmI. My problem is similar to this question: Uncaught exception thrown by finalizer

Why am I getting this error and how can I solve it?

Kilah answered 17/10, 2012 at 10:6 Comment(5)
Whats the body of method Utilities.prepareTabView()?Halloween
is your activity a MapActivity? maybe it is related to the MapActivity that you are using not related to the code you have postedApproach
@Approach yesy it is a MapActivity.Kilah
why aren't u using action bar with tabs navigation instead??Haman
are you extending your Activity with MapActivity?Emanuelemanuela
A
4

Are you doing anything db-related? It almost sounds like either the activity that's doing DB stuff has closed the cursor (manually or automatically) and then tried to do something to it in finalize(), or that the cursor is being closed by the Android OS.

In case #2, it may mean that you might have to manually close the cursor. If that's the case but if you need the activity open, consider reopening/closing it in onResume/onPause or onStart/onStart

Someone else mentioned that it might be because you are trying to open two of them at the same time

Aylmar answered 25/10, 2012 at 20:38 Comment(0)
L
1

This is somehow related to Cursor in onStop() or onDestroy(). You can invoke it by calling to closeTab() or closeAllTabs().

Hope this will help.

Lumpy answered 24/10, 2012 at 9:38 Comment(0)
G
1

Remember to close the cursor once you are done with the cursor before application traverse to another activity.

Godgiven answered 26/10, 2012 at 20:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.