该方法managedQuery(URI,字符串[],字符串,字符串[],字符串)从类型的活动是去precated [英] The method managedQuery(Uri, String[], String, String[], String) from the type Activity is deprecated
问题描述
当我编译下面code
When I compile the following code
cursor = activity.managedQuery( imageUri, proj, null, null, null );
我得到以下警告
I get following warning
该方法managedQuery(URI,字符串[],字符串,字符串[],字符串)从活动类型为pcated德$ P $
The method managedQuery(Uri, String[], String, String[], String) from the type Activity is deprecated
在code是工作的罚款。我应该怎么做才能避免这种情况?
The code is working fine. What should I do to avoid this?
推荐答案
在 managedQuery
法德precated,这意味着它不再被使用,有一个更新的方法可用。替换因为这是 getContentResolver()查询()
:
The managedQuery
method is deprecated, meaning it should no longer be used and there is an updated method available. The replacement for this is getContentResolver().query()
:
cursor = activity.getContentResolver().query(imageUri, proj, null, null, null);
您通常可以找出原因的方法是pcated德$ P $,你应该用什么来代替,通过该方法的名称,或者根据一个快速谷歌如何好javadoc的是它可能会告诉你,通过你的IDE。
You can normally find out why the method is deprecated, and what you should use instead, by a quick Google of the method name, or depending on how good the javadoc is it may inform you through your IDE.
这篇关于该方法managedQuery(URI,字符串[],字符串,字符串[],字符串)从类型的活动是去precated的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!