• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android Slideshow

_JÞ

Lurker
Hello All,
I am trying to make a simple android app that will display some images for a user specifiable number of milliseconds each.
The code below skips to the last image after 11 seconds.
could you have a look and tell me what you think.

```java
public void buttonPressed(View view){
ImageView canvas = findViewById(R.id.canvas);
delay(1000);
canvas.setImageResource(R.drawable.c1);
delay(1000);
canvas.setImageResource(R.drawable.c2);
delay(1000);
canvas.setImageResource(R.drawable.c3);
delay(1000);
canvas.setImageResource(R.drawable.c4);
delay(1000);
canvas.setImageResource(R.drawable.c5);
delay(5000);
canvas.setImageResource(R.drawable.c6);
delay(2000);
}
void delay(long ms){
long init = SystemClock.uptimeMillis();
while(SystemClock.uptimeMillis() != init+ms);
}```
I am open to C/C++ alternatives.
I was wishing there was a 'call kernel' function for the display.
In the future I would like to have the user be able to select or take the pictures.
P.S. how do you format your code on this forum
 
Back
Top Bottom