gpt4 book ai didi

android - 打开 MapActivity 时出现“终结器引发的未捕获异常”

转载 作者:塔克拉玛干 更新时间:2023-11-02 18:53:22 26 4
gpt4 key购买 nike

我的代码中有这些行:

// 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)

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

为什么会出现此错误,我该如何解决?

最佳答案

你在做任何与数据库相关的事情吗?这几乎听起来像是正在执行数据库操作的 Activity 关闭了游标(手动或自动),然后尝试在 finalize() 中对其执行某些操作,或者游标正在被 Android 操作系统关闭。

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

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

关于android - 打开 MapActivity 时出现“终结器引发的未捕获异常”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12931876/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com