- Forum posts: 1
Dec 6, 2017, 5:42:36 AM via Website
Dec 6, 2017 5:42:36 AM via Website
Hello All,
I am trying to make a simple android app that will display some images for a user specifiable number of milliseconds each.
But it just stays on the first one.
could you have a look and tell me what you think.
public class MainActivity extends AppCompatActivity {
public ImageView canvas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
canvas = findViewById(R.id.canvas);
canvas.setWillNotCacheDrawing(true);
canvas.setVisibility(View.VISIBLE);
}
public void buttonPressed(View view){
PhdMan clock;
setContentView(R.layout.activity_main);
clock = new PhdMan();
clock.delay(1000);
canvas.setImageResource(R.drawable.c1);
canvas.invalidate();
clock.delay(2000);
canvas.setImageResource(R.drawable.c2);
canvas.invalidate();
clock.delay(1500);
canvas.setImageResource(R.drawable.c3);
clock.delay(700);
canvas.setImageResource(R.drawable.c4);
clock.delay(3000);
canvas.setImageResource(R.drawable.c5);
clock.delay(1000);
canvas.setImageResource(R.drawable.c6);
clock.delay(1200);
}
}
class SMan extends Thread {
void delay(long ms){
try{
sleep(ms);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
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.