valbrux
valbrux

Reputation: 320

Transition freezing Android device

I have a problem here.This here freeze my Android phone while it works very well on the emulator, it is performed on a click on a Toolbar Command.

getContentPane().replace(getContentPane().getComponentAt(0), createAbout(), CommonTransitions.createCover(CommonTransitions.SLIDE_HORIZONTAL, false, 100));

I think it is because of the Transition. Any help?

Upvotes: 2

Views: 332

Answers (2)

Shai Almog
Shai Almog

Reputation: 52760

In the current implementation if you are running two animations at once (replace, layout etc.) you might create an invalid state that can trigger an exception/freeze.

If there is a chance of that you need to set a flag before starting the animation and release it when its done e.g.:

if(!globalLockFlag) {
    globalLockFlag = true;
    // change stuff and use animateLayoutAndWait or replaceAndWait
    globalLockFlag = false;
} else {
   // use timer or callSerially to postpone or skip animation entirely
}

Upvotes: 0

Diamond
Diamond

Reputation: 7483

What you could do if you just want to animate replacement is:

getContentPane().replace(getContentPane().getComponentAt(0), createAbout(), null);

getContentPane().animateLayoutAndWait(200);

Upvotes: 1

Related Questions