Ido Azulay
Ido Azulay

Reputation: 47

Android Transition between Activities from non-Activity Class

I'm using an activity context from a non-activity class. I don't want any transition between Activities, but sometimes there is no transition and sometimes there is.
Here is my code:

Intent myIntent = new Intent(this.context, Lose.class);
context.startActivity(myIntent);
((Activity)context).overridePendingTransition(0, 0);

Does anyone understands what part of my code causes this inconsistent behaviour?

Upvotes: 0

Views: 204

Answers (1)

SuperFrog
SuperFrog

Reputation: 7674

Try adding this to your Intent:

myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

Upvotes: 1

Related Questions