I have been commissioned by the Autonomous University of Barcelona to make an app that shows images of the microscope stage of a mineral sample.
Specifically I have photos of the same sample spaced by a five degree turn (72 images). Downloaded from the AUB website.
Below the image there has to be a seekbar and the images have to be loaded as it moves, giving the impression that the microscope stage is rotating.
I have tried it with Picasso:
public class FichaOpacos extends AppCompatActivity {
private String urlParalelos;
private ImageView platina;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ficha_opacos);
Intent intent = getIntent();
String id = intent.getStringExtra("id");
Database myDb = new Database(this);
String mineral = myDb.getMineral(id);
platina = (ImageView) findViewById(R.id.platina);
urlParalelos = myDb.getURL1(mineral);
myDb.closeDatabase();
String urlInicialParalelos= urlParalelos+ "1.jpg";
Picasso.get().load(urlInicialParalelos).into(platina);
SeekBar seekBar = findViewById(R.id.seek);
seekBar.setProgress(0);
seekBar.incrementProgressBy(1);
seekBar.setMax(71);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
// TODO Auto-generated method stub
String urlFinalParalelos = urlParalelos+ String.valueOf(progress+1) + ".jpg";
Picasso.get().load(urlFinalParalelos).into(platina);
}
});
}
}
The problem is that in the transition between images the image disappears and then after milliseconds the next one appears, not giving the impression that you are looking at a rotating microscope stage.
How could I get the desired effect?
I imagine I need an animation that keeps the previous image until the next image is displayed, but I have never worked with animations and would not know how to implement it.

The solution I have found that produces the expected result is to download the 72 images at the start of the activity.
In this way the images are available and load quickly and it seems that the microscope stage rotates.
The only drawback is that the user has to wait a few seconds to load the activity.