How to switch activity without animation in Android? How to switch activity without animation in Android? android android

How to switch activity without animation in Android?


You can create a style,

 <style name="noAnimTheme" parent="android:Theme">   <item name="android:windowAnimationStyle">@null</item></style>

and set it as theme for your activity in the manifest:

   <activity android:name=".ui.ArticlesActivity" android:theme="@style/noAnimTheme">    </activity>

You can also define a style to specify custom entry and exit animations.http://developer.android.com/reference/android/R.attr.html#windowEnterAnimation


If your context is an activity you can call overridePendingTransition:

Call immediately after one of the flavors of startActivity(Intent) or finish to specify an explicit transition animation to perform next.

So, programmatically:

this.startActivity(new Intent(v.getContext(), newactivity.class));this.overridePendingTransition(0, 0);


Try this code,

this.startActivity(new Intent(v.getContext(), newactivity.class).addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION));