Let's say I have fragment A in my current view. I animate myView in onCreateView method. Then I commit another fragment (fragment B) on top of fragment stack. When I go back to fragment A, myView animation is again started which I don't want it to. I think I should move the animation part to some other method. Would you please help?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    ...
    animate myView;
    ...
    someOtherView.setOnClickListener(new View.OnClickListener() {
        @Override
        public boolean onClick(View v, MotionEvent event) {
         getActivity().getSupportFragmentManager().beginTransaction()
                            .addToBackStack(null)
                            .replace(R.id.framelayout_home,new Fragment_B()).commit();
        }
    });
    return rootView;
}
 
     
    