[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-28 Thread Streets Of Boston
Great you figured that one out! :-) On Jun 27, 9:12 pm, Bara bara.kath...@gmail.com wrote: I figured it out!  As it turns out, I have the ListView's visibility set to GONE by default.  I show the ListView in my OnClick event for my button.  When the orientation changes and the Activity gets

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-27 Thread Bara
I figured it out! As it turns out, I have the ListView's visibility set to GONE by default. I show the ListView in my OnClick event for my button. When the orientation changes and the Activity gets destroyed and re-created, the ListView's visibility gets reset to the default set in the XML,

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-23 Thread Streets Of Boston
thisListView.setAdapter(r_adapter); r_adapter.notifyDataSetChanged(); If you do 'setAdapter', calling notifyDataSetChanged() is not necessary, if i'm not mistaken. But calling an extra notifyDataSetChanged() should hurt. Override the adapter's getItem and getCount methods and put a break- point

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Streets Of Boston
You return an object that doesn't hold any permanent residence to an activity, just a temporary one. private final Runnable mUpdateDisplayRunnable = new Runnable() { public void run() { mData.getCurrentActivity().updateDisplay(); } }; public void onCreate(...) { ... mData =

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Bara
I'm sorry, but I'm still not understanding what exactly I should be holding a reference to. What should mData contain (or rather, what are the properties in the MyRetainedData class)? I appreciate the help immensely :) Bara On Jun 22, 10:23 am, Streets Of Boston flyingdutc...@gmail.com wrote:

Re: [android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Gyan
Classic problem! Use a static variable rather than onRetainConfigurationChange() lot of state data to be saved doesn't work all the time!! Gyan -- 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] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Bara
After some work, I implemented Streets of Boston's code but I am still running into the same problem. I created a new class that holds an instance of my activity. I then send this object using OnRetainNonConfigurationInstance, and use it in my Runnable to call UpdateDisplay() just like he did.

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Streets Of Boston
The call to onRetainConfigurationChange and getLastNonConfigurationInstance always works, if you have your activity declared not to handle configuration changes by itself (which it doesn't by default). On Jun 22, 10:51 am, Gyan gnanesh@gmail.com wrote: Classic problem! Use a static

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-22 Thread Bara
Hmm... could it be my ArrayAdapter class causing the problem? This is how I call it: r_adapter = new ReminderAdapater(rData.getCurrentActivity(), remindersList, thisListView); thisListView.setAdapter(r_adapter); r_adapter.notifyDataSetChanged(); And this is ReminderAdapater itself: public

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-21 Thread Streets Of Boston
This probably happens because your runnable 'mUpdateDisplayRunnable' has an implicit reference to 'this' activity that calls 'this.updateDisplay()' in its run() method. When an orientation-change happens the current activity ('this') is destroyed a brand-new activity is created. When the handler

[android-developers] Re: notifyDataSetChanged() not updating listview after orientation change

2010-06-21 Thread Bara
Wait, what exactly should I be returning with onRetainNonConfigurationInstance? Wouldn't anything I return with that be from the original activity, not the new one? So wouldn't that cause the same problem? Bara On Jun 21, 7:27 pm, Streets Of Boston flyingdutc...@gmail.com wrote: This probably