Java 使用毕加索重新加载图像
我正在使用毕加索将url图像加载到我的图像视图。图像将在同一url内更改,因此添加了刷新按钮以重新加载新图像。有什么帮助吗Java 使用毕加索重新加载图像,java,android,picasso,Java,Android,Picasso,我正在使用毕加索将url图像加载到我的图像视图。图像将在同一url内更改,因此添加了刷新按钮以重新加载新图像。有什么帮助吗 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); } @Override public void onResume() { super
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
@Override
public void onResume() {
super.onResume(); // Always call the superclass method first
ImageView v = (ImageView) findViewById(R.id.iv3);
Picasso.with(this).load("http://xxxxx/cgi-bin/video.JPG").into(v);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
else if(id==R.id.refresh){
onResume();
}
return super.onOptionsItemSelected(item);
}
}我添加了这一行,现在运行良好
Picasso.with(this).invalidate()代码>