getContentResolver查询导致CursorWrapperInner警告 [英] getContentResolver query cause CursorWrapperInner warning

查看:170
本文介绍了getContentResolver查询导致CursorWrapperInner警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在4.0.3上,代码下面导致警告W / CursorWrapperInner(11252):Cursor finalized without prior close()。

On 4.0.3, Code below cause warning "W/CursorWrapperInner(11252): Cursor finalized without prior close()".

    Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
    getContentResolver().query(uri, null, null, null, null);

在sorce中,我发现警告来自哪里,任何人都告诉我如何避免它与一些奇怪的问题有关吗?

In sorce, I found the warning where it come from, anyone tell me how to avoid as i doubt it related to some weird problem?

推荐答案

我也遇到了这个奇怪的问题。我使用ContentProvider为我提供了一个Cursor和CursorLoader来处理我的Fragment / Activities中的抓取。

I have also experienced this weird issue. I'm using a ContentProvider to provide me with a Cursor and a CursorLoader to handle the fetching in my Fragment/Activities. So I'm doing everything "to the book".

我使用4.1.1设备时遇到了此警告消息,但似乎已经在我的Nexus 7上消失了为4.2。

I experienced this warning message using a 4.1.1 device, but it seems to have gone away on my Nexus 7 which is 4.2. Personally I would not take any serious notice of this warning.

更新:
我使用Android v2.2测试我的代码,我得到了一个完整的stacktrace从这个错误。原来,我的代码是获取另一个光标(而不是使用加载器获取),这是这个令人讨厌的代码。手动关闭这个功能。

Update: I was testing my code with Android v2.2 and I got a full stacktrace from this error. It turned out that my code was fetching another Cursor (not the one fetched using a Loader) and it was this that was the offending code. Closing this manually did the trick.

这篇关于getContentResolver查询导致CursorWrapperInner警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆