
Adithya Narayan
Engineer
SGS
Hi,
When my Updater Service is broadcasting a specified intent, my Broadcast Receiver associated with the Timeline Activity is receiving it. Now, the problem is after cursor.requery() the next statement timelineAdapter.notifyDataSetChanged() is having no effect on the Activity where timelineAdapter is the adapter which is responsible for mapping the data from database table columns to the ListView's attributes.
I was under the impression that when timelineAdapter.notifyDataSetChanged() is called automatically the TimelineActivity.onResume() method should be called. Am i right ? Or we need to call TimelineActivity.onResume() explicitly in order to refresh the Activity and the UI ?

Vivek Ragunathan
NA
I too had the same problem. Ideally the list should get refreshed on requery + notifyDataChanged but it does not work. Not sure why. So I used the following method to make it work:-
private void refresh()
{
cursor = getYamba().getStatusData().getStatusupdates();
startManagingCursor(cursor);
cursorAdapter = new TimelineAdapter(this, cursor);
listTimeline.setAdapter(cursorAdapter);
}
class TimelineReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
// cursor.requery();
// cursorAdapter.notifyDataSetChanged();
cursor.close();
refresh();
Log.i(LogTag, String.format("TimelineReceiver.onReceive(%s)", intent.getAction()));
}
}
Hope that helps.