Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { public static void setRootEnabled(Context context, boolean isRoot) { SharedPreferences preferenceScreen = PreferenceManager.getDefaultSharedPreferences(context); preferenceScreen.edit().putBoolean("isRootEnabled", isRoot).apply(); } }