android – 打开MapActivity时’终结器抛出未捕获的异常’

前端之家收集整理的这篇文章主要介绍了android – 打开MapActivity时’终结器抛出未捕获的异常’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的代码中有这些行:
// 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;
    }

当应用程序运行行tabHost.addTab(tabspecWhereAmI)时;我只在LogCat中得到以下错误,程序运行没有任何问题:

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)

此异常发生在ActWhereAmI的onCreate(…)方法之前.我的问题类似于这个问题:Uncaught exception thrown by finalizer

为什么我会收到此错误,如何解决

解决方法

你在做与db有关的事吗?它几乎听起来像正在执行数据库操作的活动已关闭光标(手动或自动)然后尝试在finalize()中执行某些操作,或者操作系统正在关闭光标.

在#2的情况下,这可能意味着您可能必须手动关闭光标.如果是这种情况但是如果您需要打开活动,请考虑在onResume / onPause或onStart / onStart中重新打开/关闭

其他人提到这可能是因为你试图同时打开其中两个

原文链接:https://www.f2er.com/android/315611.html

猜你在找的Android相关文章