enable Hardware Accelerated - Android Hardware

Android examples for Hardware:Sensor

Description

enable Hardware Accelerated

Demo Code


//package com.java2s;
import android.app.Activity;

import android.util.Log;

public class Main {
    private static final String TAG = "ViewUtils";

    public static void enableHardwareAccelerated(Activity activity) {
        if (activity == null) {
            Log.w(TAG,/*from   w w w  . j  a  v a 2 s .  c om*/
                    "Argument 'activity' is null at enableHardwareAccelerate()");
            return;
        }

        if (android.os.Build.VERSION.SDK_INT < 14) {
            Log.w(TAG, "SDK level must >= 14 on enableHardwareAccelerate()");
            return;
        }

        activity.getWindow().setFlags(
        /*FLAG_HARDWARE_ACCELERATED=*/0x01000000,
        /*FLAG_HARDWARE_ACCELERATED=*/0x01000000);
    }
}

Related Tutorials