由于您正在更新 sameImageView: imageView
和 same TextView: text
,因此只会看到最后一个 Bitmap 和 Text。
您是否尝试将所有位图和相应的文本添加到布局中?
执行以下操作:
for(int i=0; i<numImages; i++)
{
// Stuff processes here including getting a new Bitmap bmp image
ImageView imageView = new ImageView(this);
imageView.setImageBitmap(bmp);
parent.addView(imageView);
TextView text = new TextView(this);
text.setText(text.getText()+"image "+i+" a success!\n");
parent.addView(text);
Log.d("update", text.getText()+"image "+i+" a success!\n");
}
如果您想每隔几秒向 ImageView 添加一个位图:
private Timer timer = new Timer();
private TimerTask timerTask;
timerTask = new TimerTask() {
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
//Keep a count and change the ImageView and Text depending on that count
}
});
}
};
timer.schedule(timerTask, 0, 5000);