문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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

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

hope it helps :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top