Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using overridePendingTransition makes the calling activity disappear when new activity "pops" in in Android Kitkat?

How do I stop this from happening? The calling activity disappears when the new acitivity "pops" in using overridePendingTransition. I am using overridePendingTransition so as to animate on older devices. I just need to stop the calling activity from disappearing like what I have done on LOLLIPOP devices

if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
    Window window = activity.getWindow();
    window.setExitTransition(null);
}

Take note this only happens on Android Kitkat 4.4. I tried getting a Scene for the whole layout activity and then setting the exitAction to null but it didn't work.

How can I do this?

like image 882
John Ernest Guadalupe Avatar asked Nov 27 '15 07:11

John Ernest Guadalupe


1 Answers

I found out the answer to this problem just now.

It seems like my theme attributes are messing up the animations. To solve this I had to set the following attributes:

    <item name="android:windowIsTranslucent">false</item>
    <item name="android:windowIsFloating">true</item>

which were originally:

    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowIsFloating">false</item>

After that, it worked properly on Kitkat and I tested on the other APIs and it still works as expected. I hope this helps someone else solving this issue

like image 163
John Ernest Guadalupe Avatar answered Nov 17 '22 21:11

John Ernest Guadalupe