I have two activities and a slide transition between them. Simple enough. But, for whatever reason ActivityOptions.makeSceneTransitionAnimation(Activity)
seems to create an empty activity on the stack. Or rather, it keeps my original activity on the stack, but nulls out the root view so it looks like a blank activity.
I'm using the most vanilla way to create a scene transition from the docs. I'm not quite sure why this is a problem unless it's a known issue. Anyone else experience this? If so, have you fixed it?
public void startSearchActivity(MenuItem view) {
Intent searchActivity = new Intent(this, SearchActivity.class);
ActivityOptions transitionActivityOptions = ActivityOptions.makeSceneTransitionAnimation(HomeActivity.this);
startActivity(searchActivity, transitionActivityOptions.toBundle());
}
private void setupWindowAnimations() {
Transition slide = new Slide();
slide.setDuration(1000);
((Slide)slide).setSlideEdge(Gravity.LEFT);
getWindow().setEnterTransition(slide);
getWindow().setReenterTransition(slide);
getWindow().setExitTransition(slide);
}
And then in activity #2 I simply call either finish,onBackPressed
, or finishFromTransition
. None of which seem to get me back to the original activity I had on the stack. If I press back from activity #2, activity #1's onResume()
does get called..but it's as if it never got its content set or any of its view initialized. If I launch the app again, the original activity has its onCreate
get called which re-binds and relays out views.
Another odd thing to note is that the android soft "back", "home", and "recents" buttons aren't displayed when entering this blank activity. In fact, the only thing that looks like is retained from my app is the status bar color.
UPDATE: I've noticed that if I don't let the transition finish, and press back. It will go back to my previous activity just fine. It's only when the transition finishes and I make it to the next activity that I run into problems.
Wow... I figured it out. Turns out it's out of our control for now. It's an issue with api 24+. I looked at makeSceneTransition and it has separate logic for those apis (of course). That's very disheartening. Hopefully google can fix this issue soon.