Sunday, November 4, 2012

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

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 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().

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 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...@gmail.com> wrote:
> 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. [in ListView(2131230767, class android.widget.ListView) with
> Adapter(class
> com.ascentive.extremespeed.moreoptions.InstalledAppsListAdapter)
>
> The purpose of doing this is to get icons of all installed apps so that I
> can display all installed apps in list view. I refer following site -
>
> http://impressive-artworx.de/2011/list-all-installed-apps-in-style/
>
> please do suggest what alternate we can choose.
>
> Thanks in Advance
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-d...@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



--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.2 Available!

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate