0
liteDetail = LiteDetailFragment.newInstance(item);
if (Build.VERSION.SDK_INT >= 21) {
    Log.d("her1 1","------------------------------------ok hrer_-------------new");
    Slide slideTransition = new Slide();
    slideTransition.setSlideEdge(Gravity.LEFT);
    slideTransition.setDuration(getApplicationContext().getResources().getInteger(R.integer.anim_duration_long));
    liteDetail.setEnterTransition(slideTransition);
    liteDetail.setExitTransition(slideTransition);
    liteDetail.setReenterTransition(slideTransition);
}
getFragmentManager().beginTransaction().replace(R.id.frame_1, liteDetail).commit();

This is my code for fragment animation but it does not work I have seen a similar question on stack overflow but the answer is by using xml I want to know how to code in java only. Same goes for activity

private void setupWindowAnimations() {
   // Re-enter transition is executed when returning to this activity
   if (Build.VERSION.SDK_INT >= 21) {
       Log.d("trans aded","bool-------------------------");
       Fade fade = (Fade) TransitionInflater.from(this).inflateTransition(R.transition.activity_fade);
       getWindow().setEnterTransition(fade);

   }
}

I have set it just after setContentView in activity but it also does not work though the log is shown. Update: Is coordinator Layout the source of problem? Because even xml animation is not working

Sam Tholiya
  • 39
  • 1
  • 10

0 Answers0