Tuesday, November 1, 2011

Re: [android-developers] ExpandableListView expand/collapse question

Hi Kostya,

Thanks. That helped. The button clicks are definitely more responsive and I also avoid re-creating the view every second.

I also have another issue related to ExpandableListView. Can you help?

The issue is as follow:
1. I get a lot of information from a backend server (in the range of 100-200 or more ) and I display these on the expandable list view. For every message I receive, I add it to my local cache and then call the notifyOnDataSetChanged to refresh the view to show new updates.

2. If for any reason the server stops or communication link is broken, I get a whole lot of delete messages. Hence I go and delete all the messages from the expandable list view one by one and call the notifyOnDataSetChanged.

3. If the screen is currently not actively showing the messages (as in I am in some other part of the application) and if I get these delete messages then there is no issue. HOWEVER, if I am viewing the expandable list view and if I get these deletion messages then the application dies. Output from Logcat:
11-02 02:23:12.609: ERROR/AndroidRuntime(9541): FATAL EXCEPTION: main
11-02 02:23:12.609: ERROR/AndroidRuntime(9541): java.lang.NullPointerException
11-02 02:23:12.609: ERROR/AndroidRuntime(9541):     at android.widget.AbsListView.obtainView(AbsListView.java:1304)
11-02 02:23:12.609: ERROR/AndroidRuntime(9541):     at android.widget.ListView.makeAndAddView(ListView.java:1727)
11-02 02:23:12.609: ERROR/AndroidRuntime(9541):     at android.widget.ListView.fillDown(ListView.java:652)

4. Any idea why? My algorithm is basically remove the message from local list and then call notifyOnDataSetChanged. The only thing that I can suspect is that the the listview is being generated and in the process another item gets deleted. Is there a way to find out that the updating of the listview is finished?

Thanks





--
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