Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start a new activity with no transition animation in android 1.6

I am aware that from API level 5 it is possible to specify a flag in the intent to prevent the normal animation being applied when I start a new activity:

myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

However, my question is: is there a way to achieve the same thing in an app supporting android 1.6?

like image 602
Matt Colliss Avatar asked Dec 16 '10 12:12

Matt Colliss


People also ask

How do I change my activity transition on Android?

You can do this with Activity. overridePendingTransition() . You can define simple transition animations in an XML resource file. You can do this in your Activity's onCreate function.

What is transition animation in Android?

Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.


3 Answers

On the newer versions, you want to override the transition with 0,0 shortly after you start the activity:

Intent i = new Intent(this, YourNewActivity.class); 
startActivity(i);
overridePendingTransition(0,0);

I tried this on 2.1 and 4.0.3, it worked for me. =)

I found it in the docs here

like image 177
gulchrider Avatar answered Oct 19 '22 19:10

gulchrider


Use this: getWindow().setWindowAnimations(0); within the Activity that is starting.

like image 39
Wroclai Avatar answered Oct 19 '22 20:10

Wroclai


This solution worked for me (Android 2.2):

Intent intent = new Intent(getContext(), YourClass.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
getContext().startActivity(intent);
like image 6
songokuhd Avatar answered Oct 19 '22 19:10

songokuhd