Back to project page joanne.
The source code is released under:
GNU General Public License
If you think the Android project joanne listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gmail.altakey.joanne.hack; /*w ww . j av a 2s . co m*/ import android.util.Log; import android.view.WindowManager; import android.widget.Toast; import java.lang.reflect.Field; public class ToastAnimationCanceler { private final Toast mToast; public ToastAnimationCanceler(final Toast t) { mToast = t; } public void apply() { try { final Field tnField = mToast.getClass().getDeclaredField("mTN"); tnField.setAccessible(true); final Object TN = tnField.get(mToast); final Field paramsField = TN.getClass().getDeclaredField("mParams"); paramsField.setAccessible(true); final WindowManager.LayoutParams params = (WindowManager.LayoutParams)paramsField.get(TN); params.windowAnimations = android.R.style.Animation; params.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; } catch (NoSuchFieldException e) { Log.w("TAC", "cannot find TN", e); } catch (IllegalAccessException e) { Log.w("TAC", "cannot access TN", e); } } }