Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conent Transition NPE with empty shared elements

I am adding content transitions to a pretty large app and in most cases I do not have any shared elements but still want to use the transition animations. I have tracked the problem down to this line of code:

ActivityOptionsCompat.makeSceneTransitionAnimation(activity, ????);

I have tried setting Pair array to null or an empty array and I have tried just leaving it out. Everything results in the following error:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewRootImpl.setPausedForTransition(boolean)' on a null object reference

However, I only get this error on Android 6.0+, it works fine on any version of Android 5. Am I trying to do this the wrong way?

like image 369
Corgrimm Avatar asked Apr 11 '16 19:04

Corgrimm


People also ask

How do I make a transition none in CSS?

Thus, by setting transition-duration to 0s, you are most closely matching how the browser defines an element without a transition. Setting the transition-duration to the default 0s renders the transition-property irrelevant.

Why is transition property not working?

The reason for this is, display:none property is used for removing block and display:block property is used for displaying block. A block cannot be partly displayed. Either it is available or unavailable. That is why the transition property does not work.

Can you add a transition on the font family property?

You can't use animations or transitions with font-family . This means, you actually can do this, but it would change the font-family immediately instead of morphing from one font-family to another. But I found a good workaround for this (here):

Which of the following is not a valid value for transition property?

The values none , inherit , and initial cannot be used as part of a comma-separated list of property names; any list that uses them is syntactically invalid, and will therefore be ignored.


1 Answers

I did a bunch of digging in the source code and it looks like this is caused by a missed null pointer check that got fixed for Nougat.

I've got no clue how to work around it on 6.x though, unfortunately. I suppose you could add a 6.x try/catch if it's really killing you in terms of crashes, but that may also catch a bunch of other stuff you may not want it to.

like image 126
DesignatedNerd Avatar answered Sep 28 '22 11:09

DesignatedNerd