I need my ListView to be updated in a delay in some cases, so I tried to do it with while. It looks this way:
int m=2;
while (bigList.get(m).type !=1) {
final int n=m;
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
smallList.add(n, bigList.get(n));
adapter.notifyDataSetChanged();
}
}, bigList.get(n).delay);
m++;
}
But it's delayed only for the first time and then updated all at once, but I thought the delay would be throughout all the steps in while. I tried to kill/close/finalize (only the last one exists for this) the anonymous Runnable, but there was no effect. How to do that delay be on every while step? Maybe use some other constructions or what's the best way?