Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs

Dashboard
Notifications
Mark all as read
Q&A

What's the minimum API level for activity transition?

+2
−1

I was trying to show transition on activity changes. I had followed two method from SO. I lost those link so I can't add them here.

My first method was I had used overridePendingTransition on onCreate method.

overridePendingTransition(R.anim.fadein, R.anim.fadeout);

I had executed it in Android Device (API level : 21). Lollipop... Version 5.1

To me it was looking like the function doesn't work in under API level 23. I had searched in internet little bit but, didn't find. So, I was trying to do it another way.

I had added following lines to themes.xml

<style name="WindowAnimationTransition">
        <item name="android:windowEnterAnimation">@android:anim/fade_in</item>
        <item name="android:windowExitAnimation">@android:anim/fade_out</item>
</style>

And, used following code in Theme.Myapplication

<item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
<item name="android:windowActivityTransitions">true</item>

I had copy-pasted the lines from SO. As you can see there's something written tools:targetApi="l". I think l is representing Lollipop not sure if it is correct. If It is correct than it should work my device.

I was trying to execute the application in Virtual Android Device. When I was trying to start that Virtual device then my laptop started lagging that's why I didn't use Virtual Device.

I had followed the answer and another answer in that question.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+0
−0

It worked for me hardly.

Intent intent = new Intent(Activity.this, SecondActivity.class);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(Activity.this);
startActivity(intent, options.toBundle());

According to the answer, R.anim was available from API level 1 and above.

According to the answer, overridePendingTransistion was available from Android version 2.0 and above. 2.0 is called Eclair as an android app developer I will call it E (API level is 5).

According to the answer, ActivityCompat.startActivity() works for API level 22 and above.

And, answer of the code is available here

In the code written above, options is making transition and when I had added it to startActivity then, when changing the activity; it was sending transition animation with intent.

For custom transition :

Intent i = new Intent(Activity.this, SecondActivity.class);
ActivityOptions options = ActivityOptions.makeCustomAnimation(Activity.this, R.anim.fade, R.anim.fade_out);
startActivity(i,options.toBundle());
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »