Reputation: 3362
I'm using this to override the transiting animation between two activities. At first it worked properly but now, the animation won't be displayed, though it was a problem with current project so I started a new one and the same thing happens. Is this a thing caused by my device? it is a samsung galaxy S advance with 2.3.6 android. Thank you in advance
this is the code on the activity that is started:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity2);
}
and this is the first Activty that calls the second, I've just put the override immediately after startActivity and it won't work either.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this,Activity2.class);
startActivity(intent);
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
}
});
}
Upvotes: 1
Views: 304
Reputation: 11196
HI , Make sure following step is true for your device :
Settings->Display->Animations and select "All Animations"
Upvotes: 7
Reputation: 998
You need to keep your overridepending() code after starting a new intent. Also enable all animations in settings otherwise those animations wont be displayed.
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim. slide_in_left);
change the above to
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_in_left);
why do you keep both animations as one.try different xml
Upvotes: 0
Reputation: 15054
Call immediately after one of the flavors of
startActivity(Intent)
orfinish()
to specify an explicit transition animation to perform next.
Upvotes: 1