Question

I've created a button, if I click it the following will start:

public void onClick(View v) {
    // TODO Auto-generated method stub

    Crunch();
    tts.speak("Kurze Pause", TextToSpeech.QUEUE_ADD, null);     
    Unterarm();
            SitUp();

}

By calling Crunch(), I want to setContentView(R.layout.1), when it is finished I want to change the contentView to another layout, by calling Unterarm(). Then to another one by calling SitUp().

How can I handle it in the best way? I've created all of the layouts and methods, but it isn't working.

Was it helpful?

Solution

It's not working because it will execute all methods without any delay between them so you will get the feeling that only the last one is working and if the last one is restoring the initial state, you'll feel like nothing is happening.

I suggest you wrap the method inside an asyncTask and set some delay between the method calls. It should be straight forward enough.

OTHER TIPS

You have to use animations, this is from the offical documentation

http://developer.android.com/training/animation/crossfade.html

hope it helps :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top