I have a ListView in ListActivity associated with some data. I have a content provider that provides data.
ListActivity retrieves data by requesting an ad:
Uri uri = Uri.parse("content://my.provider.DocumentProvider/mystuff"); contentCursor = this.getContentResolver().query(uri, null, null, null, null);
So now the activity has a cursor. It creates an adapter and attaches it to the list:
ListAdapter adapter = new DocumentListCursorAdapter(this, R.layout.main_row_layout, contentCursor, new String[] { "titleColumn" }, new int[] { titleColumnIndex }); setListAdapter(adapter);
This works great; the list shows the data in the cursor.
But now the content provider has new data. I want the list to be updated to show new data.
The examples I saw include calling the notifyDataSetChanged adapter, but it seems to me that this breaks the separation between the content provider and the list that consumes the content.
Does the content provider need to know which adapters are connected to the cursor so that it can call its notifyDataSetChanged method? Or is there a better way that these two things do not see this way.
android listview cursor
stevex
source share