How to prioritize thread/Runnable in Android

317 views Asked by At

I'm using an AsyncTask to do some task in the background (loading data from disk) for each row of a ListView. However, when I use TraceView to see how CPU is shared between my different app threads I end-up with a case where the main thread consume almost everything and around 70 thread each one consuming few CPU time. In addition none of these threads seems to complete as the rows are not redered correctely (data is not loaded).

How could I prioritize the tasks corresponding to visuale rows: complete the task for a visualize row before running (or after stopping) a task that corresponds to a hidden row.

Is there a way to do something like using a single thread and prioritizing the corresponding Runnable instances?

0

There are 0 answers