简体   繁体   English

managedQuery始终返回相同的结果

[英]managedQuery always returns the same result

In my onItemClick method I have: 在我的onItemClick方法中,我有:

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Uri formula = ContentUris.withAppendedId(Formulas.CONTENT_URI, id);

    Cursor formulaCursor = managedQuery(formula, PROJECTION, null, null, null);
    formulaCursor.moveToFirst();

    searchBar.setText(formulaCursor.getString(formulaCursor.getColumnIndex(Formulas.TITLE)));

    startActivity(new Intent(Intent.ACTION_VIEW, formula));
}

Now the problem is that everytime it is called, the managedQuery ALWAYS returns the same result. 现在的问题是,每次调用时,managedQuery 总是返回相同的结果。 I selected all the items in my database and the text for the AutoCompleteTextView is ALWAYS the same. 我选择了数据库中的所有项目,并且AutoCompleteTextView的文本始终相同。 I debugged it and found out that Uri formula is exactly what I want to it be, with an id of 3. But Cursor formulaCursor is not. 我对其进行了调试,发现Uri formula正是我想要的,其ID为3。但是Cursor formulaCursor不是。 So the problem is the managedQuery. 因此问题出在ManagedQuery。 But I see nothing wrong with it? 但是我没有错吗?

该问题可能在ContentProvider中,所以我建议您检查一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM