0

I need to know, there is any alert function for SimpleCursorAdapter when value is added? What I want is

  1. I open MainActivity, there is ListView integrated with SimpleCursorAdapter added data by background services.
  2. When value is added by background services, I want to refresh ListView and want to know how many new value is added. (don't want to use notification).

Just like AddAll() and notifyDataSetChanged() of ArrayAdapter.

It can be possible?

Hariharan
  • 24,741
  • 6
  • 50
  • 54
PPShein
  • 13,309
  • 42
  • 142
  • 227

2 Answers2

1

The best way to do this to set a content observer on the database and use CursorLoader to load data asynchronously.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455
vijay_t
  • 776
  • 6
  • 14
0

Request a new cursor on addition of new records

cited:

requery()
This method was deprecated in API level 11. Don't use this. Just request a new cursor, so   you can do this asynchronously and update your list view once the new cursor comes back.