Im trying to write a very basic android app that displays around 5 pictures one after each other on the screen. I want it to display a different picture after about 10 seconds. Can anyone advise me on how I would go around this. Below i have outlined what i would be looking for.
Picture 1
Picture 2
Picture 3
Picture 4
Picture 5
display full screen Picture 1
wait 10 seconds
Remove Picture 1 and Display Picture 2
Wait 10 seconds
Remove Picture 2 and Display Picture 3
Wait 10 seconds
Remove Picture 3 and Display Picture 4
Wait 10 seconds
Remove Picture 4 and Display Picture 5
Wait 10 seconds
Start again
1. Action Snap - (Android) ActionSnap combines sets of 4 or 9 photos; choose a time interval of 0.1 to 5 seconds for your burst mode. The app also includes a selection of cool filters, and interestingly offers the ability to take a square photo (as well as the typical rectangular ratio).
For Android users -- Open the camera app, press and keep holding the shutter button. -- This automatically activates the Burst Mode and clicks multiple photos until you release the button.
Focus and click on the Capture button on the camera app. Once you click on the Capture button, the timer will do a countdown, which you will be able to see on your device's screen. Once the countdown is up, your camera will take a picture, which will then be automatically saved in your device's gallery.
Have you considered using Frame Animations?
You can specify an xml in your anim folder that contains a frame-by-frame animation, specifing each image duration, and other settings, check it out
UPDATE
You can also build a frame animation programmatically of course:
AnimationDrawable animation = new AnimationDrawable();
animation.addFrame(getResources().getDrawable(R.drawable.image1), 100);
animation.addFrame(getResources().getDrawable(R.drawable.image2), 500);
animation.addFrame(getResources().getDrawable(R.drawable.image3), 300);
animation.setOneShot(false);
ImageView imageAnim = (ImageView) findViewById(R.id.img);
imageAnim.setBackgroundDrawable(animation);
// start the animation!
animation.start()
you can use the CountDownTimer
: follow these steps :
1) declare an array
which will contain the identifients of your pictures
2 ) declare the CountDownTimer
like this :
int i=0;
new CountDownTimer(10000,1000) {
@Override
public void onTick(long millisUntilFinished) {}
@Override
public void onFinish() {
imgView.setImageDrawable(sdk.getContext().getResources().getDrawable(array[i]));
i++;
if(i== array.length-1) i=0;
start();
}
}.start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With