7
我想显示几个图像并在每个图像之间添加延迟。 我这样做,并没有在代码中的错误,但由于某种原因,应用程序崩溃。android延迟使用处理程序
Bitmap bitmap = BitmapFactory.decodeFile(imageIn);
ImageView myImageView = (ImageView)findViewById(R.id.imageview);
myImageView.setImageBitmap(bitmap);
// Those are the only 2 lines I used to make my handler
Handler handlerTimer = new Handler();
handlerTimer.postDelayed((Runnable) this, 20000);
如果他的“this”不管它是什么,实现Runnable,那么就像他那样做没有问题。 – Vlad 2012-06-17 16:34:28
另外:为了防止调用Looper.prepare,你可以这样创建handleTimer: handleTimer = new Handler(Looper.getMainLooper()); – Tobliug 2015-03-18 02:26:24