So I have My custom ContentProvider
. Currently only the onCreate()
method and the query()
method do anything, so I will only show that.
@Override
public boolean onCreate() {
openHelper = new SmartCalOpenHelper(getContext());
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
database = openHelper.getWritableDatabase();
return database.query("events_info", projection, selection, selectionArgs, null, null, null);
}
Of course I have an inner class that sets up all the database info. The part I do not understand is how to change the table name, like events_info
above dynamically depending on which class uses it. I currently have it calling that one table, but I need to be able to change it in order to reuse it. Any ideas would be greatly appreciated!
Parse the Uri
and extract whatever information you need to decide what kind of information the caller is asking for. See the relevant documentation for further guidance.