Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;

public class Main {
    public static void toggleHapticFeedback(Context mContext) {
        Settings.System.putInt(mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED,
                !isHapticFback(mContext) ? 1 : 0);
    }

    public static boolean isHapticFback(Context mContext) {
        try {
            return Settings.System.getInt(mContext.getContentResolver(),
                    Settings.System.HAPTIC_FEEDBACK_ENABLED) == 1;
        } catch (SettingNotFoundException e) {
            e.printStackTrace();
        }
        return false;
    }
}