I want to display an other image after a delay. Here is my code:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView=findViewById(R.id.imageView);
ArrayList<String> test = new ArrayList<String>();
test.add("e");
test.add("a");
if (test.get(0) == "e") {
Glide.with(this)
.load("https://something.something/something.jpg")
.into(imageView);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (test.get(1) == "a") {
Glide.with(this)
.load("https://something.something/something2.jpg")
.into(imageView);
}
}
}
But only the 2nd image apppears if i do that. Any solution?