Carmen Delessio wrote:
> Im my case, I've extended a ListActivity.  I want to populate the list
> when it is created and when the user scrolls to the end.
> I'm using onCreate and onScrollStateChanged. 
> Today I am using a Thread in each of those methods. 
> There is a Handler in the ListActivity class to handle messages from the
> threads.
> I can't make the connection on how to do that with an AsyncTask.
> 
> Is it not a match or am I missing it? 

I cannot say if it is a match for your specific code. That being said:

Step #1: Whatever you have in your background thread Runnable, move to
doInBackground() of an AsyncTask subclass

Step #2: Anything now in doInBackground() that uses a Handler, or
runOnUiThread(), or post(), to have done in the UI thread, move to
onPostExecute() (or publishProgress(), if you are trying to do it
incrementally)

For example, in the sample project I cited in my earlier reply, I use
AsyncTask to populate a ListView, using publishProgress() so the list is
incrementally updated rather than all at once at the end.

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

Android Development Wiki: http://wiki.andmob.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to