views:

37

answers:

1

In my onItemClick method I have:

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. I selected all the items in my database and the text for the AutoCompleteTextView is ALWAYS the same. 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. So the problem is the managedQuery. But I see nothing wrong with it?

+1  A: 

The problem is likely in the ContentProvider, so I suggest you check that.

Thorstenvv