Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-05 Thread Piren
Earlier you said you update the adapter in onPostExecute (as you should), now you're saying you're doing it in doInBackground (which is wrong and will cause this error), so which is it? On Monday, November 5, 2012 8:01:36 AM UTC+2, Bajrang Asthana wrote: Hi Piren, I am creating AsyncTask in

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-05 Thread Bajrang Asthana
Thanks Piren! Actually in doInBackground method - I am fetching icons of all installed apps and replacing the default icon( which I had set while creating list to show all installed apps) with new one. Once I am done with this I am simply notifying to adapter for data set change inside the

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-05 Thread Piren
try moving mAdapter.setIcons(icons); to onPostExecute (you'll have to make icons a member of your asynctask) On Monday, November 5, 2012 10:40:14 AM UTC+2, Bajrang Asthana wrote: Thanks Piren! Actually in doInBackground method - I am fetching icons of all installed apps and replacing the

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-05 Thread Bajrang Asthana
Yes I did that and work fine. I added all the changes in temporary object and then updated the content of adapter and notified it in postExecute() method. Thanks to All :) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-04 Thread Piren
Are you creating that AsyncTask in a background thread as well? On Sunday, November 4, 2012 6:55:33 AM UTC+2, Bajrang Asthana wrote: Yes I am updating adapter in onPostExecute() method (as it runs in UI thread). In onPostExecute() method i am simply calling adpater.notifyDataSetChanged().

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-04 Thread Bajrang Asthana
Hi Piren, I am creating AsyncTask in onCreate() method of Activity. I am modifying adapter in doInBackground() method of AsyncTask. And finally calling adpater.notifyDataSetChanged() method. On Sunday, November 4, 2012 1:45:17 PM UTC+5:30, Piren wrote: Are you creating that AsyncTask in a

[android-developers] Problem while updating adapter from AsyncTask

2012-11-03 Thread Bajrang Asthana
I am getting below error while updating adapter from AsyncTask - java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread.

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-03 Thread Mark Murphy
Make sure that you are updating your adapter in onPostExecute(), and make sure that either the adapter calls notifyDataSetChanged() or you call notifyDataSetChanged() on the adapter. On Sat, Nov 3, 2012 at 10:15 AM, Bajrang Asthana asthana.bajr...@gmail.com wrote: I am getting below error while

Re: [android-developers] Problem while updating adapter from AsyncTask

2012-11-03 Thread Bajrang Asthana
Yes I am updating adapter in onPostExecute() method (as it runs in UI thread). In onPostExecute() method i am simply calling adpater.notifyDataSetChanged(). On Saturday, November 3, 2012 7:58:29 PM UTC+5:30, Mark Murphy (a Commons Guy) wrote: Make sure that you are updating your adapter in