Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I turn on animation programatically?
    primarykey
    data
    text
    <p>How can I turn on animation programatically? I am using <code>overridePendingTransition();</code>. It doesn't work unless I turn on animation myself. Can anybody tell me how to turn on animations programatically which are inside display/Animation setting? I am using overridePendingTransition(); to open new activity . </p> <p>here are my xml </p> <p>grow_fadein_center</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;scale android:fromXScale="0.6" android:toXScale="1.0" android:fromYScale="0.6" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="@android:integer/config_longAnimTime" /&gt; &lt;alpha android:interpolator="@anim/decelerate_interpolator" android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="@android:integer/config_longAnimTime" /&gt; &lt;/set&gt; </code></pre> <p>shrink_fadeout_center :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;scale android:fromXScale="1.0" android:toXScale="0.5" android:fromYScale="1.0" android:toYScale="0.5" android:pivotX="50%" android:pivotY="50%" android:duration="@android:integer/config_longAnimTime" /&gt; &lt;alpha android:interpolator="@anim/accelerate_interpolator" android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="@android:integer/config_longAnimTime"/&gt; &lt;/set&gt; </code></pre> <p>and here is the code i am using to open intent</p> <pre><code>btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ContentResolver cr = getContentResolver(); Settings.System.putInt(cr, Settings.System.WINDOW_ANIMATION_SCALE, 0); Intent intent=new Intent(context,Second.class); startActivity(intent); overridePendingTransition(R.anim.grow_fade_in_center, R.anim.shrink_fade_out_center); finish(); //testing on textview worked without turning system animation on. Animation animation=AnimationUtils.loadAnimation(context, R.anim.grow_fade_in_center); txt.startAnimation(animation); } }); </code></pre> <p>This works only when animations are turned on. and i am doing so by settings->display->animation </p> <p>I found </p> <pre><code>ContentResolver cr = getContentResolver(); Settings.System.putInt(cr, Settings.System.WINDOW_ANIMATION_SCALE, 0); </code></pre> <p>to turn on or off animation by setting integer! but it didn't work for me! what i need is how can i turned on/off animation programatically which are in system setting?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload