I was wondering if it is possible to get the data that is on the line of the content provider directly in the cursor (or another container) in the case when I already know the uri line (in other words, I already have ContentURIs with the added line number).
Both insert and Content Observer OnChange (on android api 16) returns me an inserted / modified URI, and I would like to efficiently get data from this string (without many requests or instructions). However, the only way I found is to parse the identifier from the URI, build a query with a suggestion to highlight this id, and then get the cursor like:
long row = ContentUris.parseId(uri); String mSelectionClause = ContentProvider.Table._ID + " = ?"; String[] mSelectionArgs = {Long.toString(row)}; Uri other_uri = Uri.parse(ContentProvider.AUTHORITY_STRING + ContentProvider.UriPathIndex.Table); Cursor cursor = cr.query(other_uri ,null,mSelectionClause,mSelectionArgs,null);
Is there any other way to do this? I was wondering if uri string can be used directly
source share