The following code shows how to load an image from my server into an ImageView
with Picasso (on Android). I figured out that the image in the ImageView
is changing when the method finishes - but I want to change it when the line of code is executing.
btn_startlive.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
while(something_that_is_true_for_a_long_time){
Picasso.with(img_live.getContext()).load("http://localhost:8000/livepicture")
.networkPolicy(NetworkPolicy.NO_CACHE)
.placeholder(img_live.getDrawable())
.memoryPolicy(MemoryPolicy.NO_CACHE)
.into(img_live);
}
}
});
In this example the image does not change. Is it because the method does not end? And how to fix it?