Ich habe eine Ansicht GifImageButton. Ich möchte seine Animation starten und dann die Aktivität neu starten.Verzögerung Animation vor dem Neustart der Aktivität
Das Problem ist, dass ich möchte, dass die Animation 3 Sekunden dauert, bevor Sie die Aktivität neu starten.
Wie kann ich es tun?
dies ist mein Code:
myGifImageButton.setImageResource(R.drawable.animation);
Intent intent = getIntent();
finish();
if (intent != null) {
startActivity(intent);
}
Als ich las, der bessere Weg ist ein lauffähiges so versucht, verwende ich das, aber ich habe es nicht gelingen:
// start the animation
myGifImageButton.setImageResource(R.drawable.animation);
// delay the animation
mHandler = new Handler();
final Runnable r = new Runnable() {
void run() {
handler.postDelayed(this, 3000);
}
};
handler.postDelayed(r, 3000);
// restart the activity
Intent intent = getIntent();
finish();
if (intent != null) {
startActivity(intent);
}
so Wie kann ich die Animation vor dem Neustart der Aktivität verzögern?
König !! Vielen Dank! Ich habe jetzt den Punkt "Lauf" .. :) –