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() {
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)
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
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
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
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
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,
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
8 matches
Mail list logo