samedi 4 avril 2015

Calling setImageResource from AsyncTask multiple times


Vote count:

0




Good day everyone.


I'm working with AsyncTasks and calling publishProgress(); from doInBackground() method. I'm pretty sure there's no error until here.


I need to change an ImageView's source, like in every 3 seconds from onProgressUpdate method.


If i only do this;



agiz.setImageResource(R.drawable.image1);


initial image successfully changes to image1.


But if i try to do this (which is my goal actually)



imageView.setImageResource(R.drawable.image1);

try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}

imageView.setImageResource(R.drawable.image2);

try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}

imageView.setImageResource(R.drawable.image3);

try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}


imageView instantly turns to image3, no waiting nor showing image2.


What am i missing ?


Thanks in advance.



asked just now







Calling setImageResource from AsyncTask multiple times

Aucun commentaire:

Enregistrer un commentaire