My main activity uses tablayout with a viewpager and FragmentStatePagerAdapter. I want to open a new activity with a custom animation from one of my fragments and close it again with animation. When I open it, the only thing I see is a black screen. This is how I do it:
public class SearchActivity extends Fragment{
...
Intent myIntent = new Intent(getContext(), DetailsActivity.class);
startActivityForResult(myIntent, ACTIVITY_RESULT);
getActivity().overridePendingTransition(R.anim.animation_enter,
R.anim.animation_leave);
...
}
public class DetailsActivity extends AppCompatActivity{
...
Intent returnIntent = new Intent();
returnIntent.putExtra("result", updatesPerformed);
setResult(Activity.RESULT_OK, returnIntent);
finish();
overridePendingTransition(R.anim.animation_leave,
R.anim.animation_enter);
...
}
I tried to move the method in different places but the animation still doesn't work and I see only black screen. If I pause and resume to the same activity I see it.