Android Focus issue at start using ViewSwitcher

354 Views Asked by At

So I'm developing an Android App, it's a very simple app right now just 2 views which are switch using a ViewSwitcher. On each page there is a button to switch the views. For whatever reason the using the ViewSwitcher with an transition (smooth panning animation) on the start of the app the buttons don't correctly fire off their button pressed events.

For whatever reason they queue them up until the activity goes through a onPause / onResume cycle then they will fire all their queued events. This only happens if there is an attached animation with the ViewSwitcher. If i don't set any animation and the view switches instantly this doesn't happen. It looks like to be some sort of low level bug with the animation blocking forever on first startup.

This is how i create the animation :

    Animation inFromRight = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT, +1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f);
    inFromRight.setDuration(animDuration);
    inFromRight.setInterpolator(new AccelerateInterpolator());

Taken off a sample from the net. Any ideas how to fix this? I rather not have the user exit and re-enter the app to get working buttons.

Thanks!

0

There are 0 best solutions below