Back to project page AndroidUIExample.
The source code is released under:
Apache License
If you think the Android project AndroidUIExample 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 util; /* w ww. j a v a 2 s. co m*/ import android.annotation.SuppressLint; import android.graphics.drawable.Drawable; import android.os.Build; import android.view.View; public class UiHelper { @SuppressLint("NewApi") @SuppressWarnings("deprecation") public static void setBackground(View view, Drawable d) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(d); } else { view.setBackgroundDrawable(d); } } @SuppressLint("NewApi") public static void postInvalidateOnAnimation(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.postInvalidateOnAnimation(); } else { view.invalidate(); } } }