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 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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 postExecute() method. I 
am using approach suggested by someone in below site -

http://impressive-artworx.de/2011/list-all-installed-apps-in-style/


-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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 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 postExecute() method. I 
 am using approach suggested by someone in below site -

 http://impressive-artworx.de/2011/list-all-installed-apps-in-style/




-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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 group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[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. [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-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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 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-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


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 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 javascript: 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.comjavascript: 
  To unsubscribe from this group, send email to 
  android-developers+unsubscr...@googlegroups.com javascript: 
  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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en