I have a ListView of product review titles that is populated by a custom
ReviewListAdapter which extends BaseAdapter. When a review title is clicked
it expands to show the review text.

When the activity is loaded, a thread is created to load the data from an
API. Once data is loaded it updates the ListView on the UI thread like this:

RunOnUiThread(() => {
    if (mListAdapter == null) {
        mListAdapter = new ReviewListAdapter(this, mJsonResult.Result);
        mListView.Adapter = mListAdapter;
        mListView.ItemClick += new
EventHandler<ItemEventArgs>(ListView_ItemClick);
    }
    else {
        mListAdapter.NotifyDataSetChanged(mJsonResult.Result);
    }
});

When the user scrolls to the bottom of the list, more reviews are fetched
from the API. The ReviewListAdapter's List of Reviews is updated and
NotifyDataSetChanged() is called (the "else" condition in the code above).
Once NotifyDataSetChanged is called the ItemClick event no longer fires and
you cannot expand or collapse reviews.

I'm wondering if I'm either attaching the EventHandler in the wrong place or
if there's a bug with NotifyDataSetChanged that is breaking the ItemClick
event.

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/ItemClick-not-fired-on-ListView-after-NotifyDataSetChanged-tp4915257p4915257.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to