Back to project page MarsImagesAndroid.
The source code is released under:
Apache License
If you think the Android project MarsImagesAndroid 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 gov.nasa.jpl.hi.marsimages; //from w w w .j a va 2 s .c o m import android.annotation.TargetApi; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.StrictMode; import gov.nasa.jpl.hi.marsimages.ui.ImageViewActivity; /** * Created by mpowell on 5/6/14. */ public class Utils { private Utils() { } @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void enableStrictMode() { if (Utils.hasGingerbread()) { StrictMode.ThreadPolicy.Builder threadPolicyBuilder = new StrictMode.ThreadPolicy.Builder() .detectAll() .penaltyLog(); StrictMode.VmPolicy.Builder vmPolicyBuilder = new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog(); if (Utils.hasHoneycomb()) { threadPolicyBuilder.penaltyFlashScreen(); vmPolicyBuilder .setClassInstanceLimit(ImageViewActivity.class, 1); } StrictMode.setThreadPolicy(threadPolicyBuilder.build()); StrictMode.setVmPolicy(vmPolicyBuilder.build()); } } public static boolean hasFroyo() { // Can use static final constants like FROYO, declared in later versions // of the OS since they are inlined at compile time. This is guaranteed behavior. return Build.VERSION.SDK_INT >= VERSION_CODES.FROYO; } public static boolean hasGingerbread() { return Build.VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD; } public static boolean hasHoneycomb() { return Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB; } public static boolean hasHoneycombMR1() { return Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1; } public static boolean hasIceCreamSandwich() { return Build.VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH; } public static boolean hasJellyBean() { return Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN; } public static boolean hasJellyBeanMR2() { return Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR2; } public static boolean hasKitKat() { return Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT; } }