Thursday, November 17, 2011

[android-developers] second call to setListAdapter() ignored

As far as I can tell, a second call to setListAdapter( new
MyCustomAdapter() ) has no effect: the adapter I originally installed
in my ListActivity subclass's onCreate() method continues to get
called. Is this a known problem/feature? MyCustomAdapter extends
BaseAdapter, as I've read it must if it's going to implement
the SectionIndexer interface.

What I'm doing: My list activity displays a huge (up to 2.7M) list of
words, and allows the user to change the subset displayed, e.g. to
include only words four letters long. When a filter like that is
specified, I need to force SectionIndexer.getSections() to be called
again since the section indices may be different or fewer.

I've tried calling notifyDataSetChanged, but it has no effect. I'm
now trying to instantiate a new MyCustomAdapter and pass it to
setListAdapter(). The setListAdapter() call doesn't raise any errors,
but calls continue to come into the original instance of
MyCustomAdapter. As far as I can tell, the second instance is
ignored.

Suggestions for debugging this or working around the problem?

Thanks,

--Eric

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment