Here is the link to recording while pressing back button
While i am using a animation in a fragment transaction it's working fine but i am getting a flicker of the next screen which is annoying me. I have been searching for it since 2 days no progress.
I am using this code for transition
public void moveToBaseSelect() {
FragmentTransaction ft = fragmentManager.beginTransaction();
ft.setCustomAnimations(R.anim.enter_from_right,R.anim.exit_to_left,R.anim.enter_from_left,R.anim.exit_to_right);
ft.replace(R.id.home_frame, new BaseSelectFragment(), HomeActivity.BASE_SELECT);
ft.addToBackStack(HomeActivity.BASE_SELECT);
ft.commit();
}
public void moveToLogin()
{
if(fragmentManager.getBackStackEntryCount()>=1 && fragmentManager.getBackStackEntryAt(fragmentManager.getBackStackEntryCount()-1).getName().equals(HomeActivity.LOGIN))
return;
FragmentTransaction ft = fragmentManager.beginTransaction();
ft.setCustomAnimations(R.anim.enter_from_right,R.anim.exit_to_left,R.anim.enter_from_left,R.anim.exit_to_right);
ft.replace(R.id.home_frame, new LoginFragment(), HomeActivity.LOGIN);
ft.addToBackStack(HomeActivity.LOGIN);
ft.commit();
}
The anim files
enter from left
<set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="-100%p"
android:toXDelta="0%p" />
</set>
</set>
Enter from right
<?xml version="1.0" encoding="utf-8"?>
<set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="100%p"
android:toXDelta="0%p" />
</set>
</set>
exit to left
<?xml version="1.0" encoding="utf-8"?>
<set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="0%p"
android:toXDelta="-100%p" />
</set>
</set>
exit to right
<?xml version="1.0" encoding="utf-8"?>
<set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="500"
android:fillAfter="true"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXDelta="0%p"
android:toXDelta="100%p" />
</set>
</set>
I have tried a alternative that's working by using animator instead of anim and app.fragment instead of v4.fragment
But I am extremely curious to know is there any solution if i stick with the anim method