5

Have found already some people asking the same, but the solutions didn't work for me.

I see no animation.

Calling it this way:

Intent intent = new Intent(this, MyActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.fadein, R.anim.fadeout);

fadein.xml and fadeout.xml are in the anim folder:

fadein.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />
</set>

fadeout.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

  <alpha
      android:duration="1000"
      android:fromAlpha="1.0"
      android:interpolator="@android:anim/accelerate_interpolator"
      android:toAlpha="0.0" />

</set>

Using min. API 7:

manifest:

<uses-sdk android:minSdkVersion="7"/>

API 7 is also in my project.properties file:

target=android-7

What am I doing wrong?

P.D. Removing the lines with the interpolator doesn't change anything.

Already seen / tried:

overridePendingTransition doesn't work

overridePendingTransition does not work when FLAG_ACTIVITY_REORDER_TO_FRONT is used

Fade in Activity from previous Activity in Android

Fade in Activity from previous Activity in Android

Activity transition in Android

Community
  • 1
  • 1
User
  • 31,811
  • 40
  • 131
  • 232
  • please check this solution http://stackoverflow.com/questions/4633543/overridependingtransition-does-not-work-when-flag-activity-reorder-to-front-is-u – all-ok Jan 02 '13 at 06:28
  • i codded a basic workadrond :) read my ansver http://stackoverflow.com/a/22035320/686463 – Enes Feb 26 '14 at 08:12

4 Answers4

16

The problem was that the device, at least in the case of Samsung Galaxy, has to have animations enabled for this to work. This can be done in the settings menu.

User
  • 31,811
  • 40
  • 131
  • 232
14

You need to make sure that you havn't turned it off in the device using the Settings > Developer Options:

enter image description here

you should turn on Transition animation scale.

SMR
  • 6,628
  • 2
  • 35
  • 56
broken byte
  • 141
  • 2
  • 4
3

As you said in some Samsung devices (maybe others to) the option "All animations" in Settings->Display->Animation ha to be selected and not the default "Some animations"

linakis
  • 1,203
  • 10
  • 19
0

The problem that might be happen to you, for animation doesn't work, it's because your current activity is different from the next activity you intent to. And instead to make the animation he destroy the current activity, and therefor the animation doesn't show, make sure that your both activity's are in the same orientation.

Alejandro Alcalde
  • 5,990
  • 6
  • 39
  • 79