When I want to check and see if there is something in my ContentProvider , what I usually do is something like this
Cursor c = getContentResolver().query(table,projection,selection,selectionArgs,sort); if(c != null && c.moveToFirst()){
but this means that I always need to make a possible unnecessary database call slowing down, especially the more checks in the database that I need to do. There should be a better way to handle this, so I don't always have to ask first.
I reviewed this question
Android Contentprovider - update in insert method
but with insertWithOnConflict it only checks the identifier of the primary key, and in my case this will not work, because I do not check the identifier, but a unique row from the server database.
Is there something I can do with the Content Provider, so I donβt always have to make a request to check if an element exists in it?
android android-contentprovider sqlite
tyczj
source share