I use this code from here to create a Flip Card Animation for older Android devices. Now I want to flip to a Fragment which is not in the current Activity. I tried with this code:
MyFragment f = new MyFragment();
getActivity().getSupportFragmentManager().beginTransaction().add(R.id.item_detail_container, f).commit();
getActivity().getSupportFragmentManager().executePendingTransactions();
f.getView().setVisibility(View.GONE);
View root = getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
FlipAnimation flipAnimation = new FlipAnimation(this.getView(), f.getView());
root.startAnimation(flipAnimation);
But then it comes to a NullPointerException on toView.setVisibility(View.VISIBLE);
in the FlipAnimation class. How can I flip to a Fragment which is not in the current Activity?
EDIT: I solve the question with the answer 1 and the comments from it. The Code here is updated and works fine now.