我正在使用Picasso Library从服务器加载图像。我想每秒更新图像大约5-10次。它甚至不能以1帧/秒的速度加载
protected String doInBackground(String... data) {
while (refreshImage) {
runOnUiThread(new Runnable() {
@Override
public void run() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Picasso.with(getApplicationContext())
.load(getImageURL).into(videoImage);
}
}, 1000);
}
});
}
return null;
}
还有其他方法可以快速帧速率更新ImageView吗?
答案 0 :(得分:0)
请尝试以下线程功能
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
if (Chcek online condition here) {
runOnUiThread(new Runnable() {
@Override
public void run() {
//Do your task here...
}
});
}
try {
Thread.sleep(1000);
} catch (Exception e) {
}
}
}
}).start();