Hi I think you have one loop to iterate which is the data got from any Web Service.
- Basically all the long running process which are need for UI changes can be run inside the AsyncTask, which will create background threads.
class AsyncExaple extends AsyncTask<Void, Void, Void>{
@Override
protected Void doInBackground(Void... params) {
//What ever the long running tasks are run inside this block
//would like to run this loop in parallel
for (int i = 0; i < processes.size(); i++) {
// calculations
}
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
}
};
To call this AsyncTask do as follows
AsyncExaple asyncExaple = new AsyncExaple();
asyncExaple.execute();
If you still want to use the Threads use below code:
new Thread(new Runnable() {
@Override
public void run() {
}
}).start();
私はあなたの両方の方法を試してみましたが、それはAsyncTaskやクラッシュにリストが表示されません..お返事ありがとうございましたを使用して
AsyncTask
スレッド内。 –