android ActivityOptions.isReturning() NullPointerException-ThrowExceptions

Exception or error:

In which case I have

java.lang.NullPointerException: Attempt to invoke virtual method
‘boolean android.app.ActivityOptions.isReturning()’ on a null object
reference

I cannot understand why EnterActivityOptions.isReturning() in ActivityTransitionState give me null?

How to solve:

Try with support library 24.1.0 (released today, but not sure if this fix your problem)

###

I believe the problem is with the variable EnterActivityOptions
When I look into your code sample it’s look like you assigned some value to EnterActivityOptions in the method of setEnterActivityOptions

But I am not sure that this method is calling when you invoke the activity.

if it’s not calling the method then obviously it will not be initialized and the variable value will be null this results NullPointerException.

So, to resolve this issue please try to check the case whether EnterActivityOptions is null or not and then use the condition

if (mEnterActivityOptions.isReturning()) {
    Your code will place here
}

###

On API 21, only one call to startPostponedEnterTransition is allowed

Leave a Reply

Your email address will not be published. Required fields are marked *