pardom-zz / ActiveAndroid

Active record style SQLite persistence for Android
http://www.activeandroid.com
4.7k stars 1.03k forks source link

ContentProvider.createUri documentation #557

Closed MkazemAkhgary closed 5 years ago

MkazemAkhgary commented 5 years ago

where is documentation for ContentProvider.createUri ?

new CursorLoader(context,
                ContentProvider.createUri(myModel.class, null),
                null, null, null, null);

So i want to filter items from myModel table. i think it has to do with these null parameters?

what i want is


SELECT * FROM myTable WHERE foreignKey = ?
naXa777 commented 5 years ago

ActiveAndroid's ContentProvider.createUri is not documented. The second parameter of createUri() is an entity ID.
how do I know this? Just read from the source code of com.activeandroid.content.ContentProvider.

I assume that CursorLoader class comes from Android SDK. Here's a documentation for its public constructor: CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

Your SQL query contains WHERE clause, so you probably need to use selection and selectionArgs parameters of the constructor. See this question for a usage example. Browse Stack Overflow and Github for more examples.

IMHO this kind of questions is not a fit for Github Issues. You have better chances to find the answer at Stack Overflow.

MkazemAkhgary commented 5 years ago

@naXa777 thanks a lot for the answer. my bad, i will try to ask only relevant questions here.