On Oct 21, 10:02 pm, Streets Of Boston <[email protected]>
wrote:
> No need to call 'invalidate()' on your list-view.
> Call 'notifyDatasetChanged()' on your customer adapter instead,
> whenever you add or delete elements in your ArrayList or change the
> contents of existing elements in your ArrayList.

Hi,
I'm now trying this again, based on the SDK Notepadv3 example. This
uses a SimpleCursorAdapter.

I have a background Service that updates the database then calls a
callback in the main activity:

        public void serviceUpdate() {
                handler.post(new Runnable() {
                        public void run() {
                                // Break encapsulation to get at the 
SimpleCursorAdapter.
                                final SimpleCursorAdapter simpleCursorAdapter =
(SimpleCursorAdapter) getListView().getAdapter();
                                simpleCursorAdapter.notifyDataSetChanged();
                                getListView().setSelection(0);
                        }
                });
        }

It doesn't redraw the ListView though. It is only redrawn when another
Activity launches which covers it, and gets closed.

I'm now looking for the proper way to do it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to