Vote count:
1
I am trying make an animation in my app which needs to stop after a given time. I cannot be using animation list because I have tried stopping it but it doesn't stop or animates only once with android one shot option. I then used the following code with handler and tried to change the drawables with handler delay. Please help me with this to make it animate and stop after delay.
final int k=0;
for(int h=0;h<9;h++)
{
final Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
int Drw[] = {R.drawable.one, R.drawable.two,R.drawable.three,R.drawable.four,
R.drawable.five, R.drawable.six, R.drawable.seven, R.drawable.eight};
ImageView nc = (ImageView) findViewById(R.id.imageView1);
nc.setBackgroundResource(Drw[jlog(k)]);
}
},500);
}}
private int jlog(int l)
{l++;
return l;
}
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire