[android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
I wasn't able to get the AsyncTask to work (although I have used it successfully in another app). What I did was use the Looper.prepare(); in my run() method: public void run(){ Looper.prepare(); loadsongs(CURRENT_PLAYLIST); mHandler = new Handler() {

Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Mark Murphy
Ken H wrote: I wasn't able to get the AsyncTask to work (although I have used it successfully in another app). Here's an example of using AsyncTask to asynchronously populate a ListView: http://github.com/commonsguy/cw-android/tree/master/Threads/Asyncer/ -- Mark Murphy (a Commons Guy)

[android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
But what if you're using a custom ArrayAdapter? Also, I *think* AsyncTask is meant for one shot type tasks. A user of this app may update this listview multiple times. But here is something I've discovered: if I change the orientation of the screen, the list is properly updated. Question: how can

Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Mark Murphy
Ken H wrote: But what if you're using a custom ArrayAdapter? And that matters...how, exactly? Also, I *think* AsyncTask is meant for one shot type tasks. A user of this app may update this listview multiple times. :: shrug :: Fire new instances of the AsyncTask. It uses a thread pool. It

Re: [android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Jason Proctor
Fire new instances of the AsyncTask. It uses a thread pool. It is designed for the specific purpose we are telling you to put it to. or you could use AsyncTasks's progress reporting mechanism to communicate the loading of each list entry. AsyncTask is *fab* -- jason.vp.engineering.particle

[android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Bob Kerns
Using a custom ArrayAdapter doesn't seem to me to relate to your question, unless your problem is that it's broken. For example, if yours doesn't notify the registered DataSetObservers that the data has changed. As for async tasks -- what you're describing IS a one-shot task, in any sense that

[android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
Wow, dude...thanks! That was a thorough answer. Usually get a vague, one sentence response that leaves me more confused than before. I don't know why I said that thing about the custom adapter...I think because I don't truly understand what it's doing and this activity revolves around it. Well,

[android-developers] Re: Can't show ProgressDialog during listview update

2010-02-18 Thread Ken H
Just tried the asynctask again, and it works. Basically I put the time consuming part in doInBackground(), and then launched a progressDialog in onProgressUpdate() to let users know nothing froze, and finally dismissed the progrssDialog in onPostExecute(). Also added the final refresh of the