int[] imageIds = new int[] {
R.drawable.timer1,
R.drawable.timer2,
R.drawable.timer3,
R.drawable.timer4,
R.drawable.timer5,
R.drawable.timer6
};
int currentImageId = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ImageView imageView = (ImageView)findViewById(R.id.imageView);
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
if(msg.what == 0x123) {
imageView.setImageResource(imageIds[currentImageId++%imageIds.length]);
}
}
};
new Timer().schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
handler.sendEmptyMessage(0x123);
}
}, 0, 250);
}