I have a content provider that returns a MatrixCursor for the query() method.
Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
{
MatrixCursor cursor = new MatrixCursor(new String[]{"a","b"});
cursor.addRow(new Object[]{"a1","b1"});
return cursor;
}
In the LoaderManager's onLoadFinished() callback method I use the cursor data to update a text view.
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
cursor.moveToFirst();
String text = (String) textView.getText();
while (!cursor.isAfterLast()) {
text += cursor.getString(1);
cursor.moveToNext();
}
textView.setText(text);
}
The question now is, how do I add a new row to the MatrixCursor that will notify the change to LoaderManager's callback methods promptly?
I hope, I have made the question clear. Thanks in advance.