Example usage for android.content Context MODE_WORLD_READABLE

List of usage examples for android.content Context MODE_WORLD_READABLE

Introduction

In this page you can find the example usage for android.content Context MODE_WORLD_READABLE.

Prototype

int MODE_WORLD_READABLE

To view the source code for android.content Context MODE_WORLD_READABLE.

Click Source Link

Document

File creation mode: allow all other applications to have read access to the created file.

Usage

From source file:Main.java

public static void SpIntertInt(Context c, String key, int value) {
    SharedPreferences sp = c.getSharedPreferences("XGram", Context.MODE_WORLD_READABLE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putInt(key, value);//from   w ww  . j a v  a 2s . com
    editor.apply();
}

From source file:Main.java

public static void SpIntertBoolean(Context c, String key, Boolean value) {
    SharedPreferences sp = c.getSharedPreferences("XGram", Context.MODE_WORLD_READABLE);
    SharedPreferences.Editor editor = sp.edit();
    editor.putBoolean(key, value);//w ww . j av  a2  s. c  om
    editor.apply();
}

From source file:Main.java

public static File getCacheDir(Activity act) {

    return act.getDir("cacheFile",
            Context.MODE_PRIVATE | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);

}

From source file:Main.java

public static File getDataUpdateDir(Activity act) {

    return act.getDir("update",
            Context.MODE_PRIVATE | Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);

}

From source file:Main.java

public static void clearSharedPreferences(Context context, String name) {
    SharedPreferences.Editor userInfoEditor = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE)
            .edit();//  w w w .j  a  v  a2 s .  c  om
    userInfoEditor.clear();
    userInfoEditor.remove(name);
    userInfoEditor.commit();
}

From source file:Main.java

public static int ReadSharedPreferencesInt(Context context, String name, String key, int defaultvalue) {
    try {//from  ww w . ja v  a2 s . c  o  m
        SharedPreferences userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE);
        return userInfo.getInt(key, defaultvalue);
    } catch (NullPointerException e) {
        return -1;
    }
}

From source file:Main.java

public static long ReadSharedPreferencesLong(Context context, String name, String key, long defaultvalue) {
    try {//from  w w  w  .  j a v  a2  s  .c  om
        SharedPreferences userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE);
        return userInfo.getLong(key, defaultvalue);
    } catch (NullPointerException e) {
        e.printStackTrace();
        return 0;
    }
}

From source file:Main.java

public static SharedPreferences getNotificationSettings(Context context, int slot) {
    return context.getSharedPreferences(getNotificationName(slot), Context.MODE_WORLD_READABLE);
}

From source file:Main.java

public static Map<String, ?> ReadSharedPreferences(Context context, String name) {
    SharedPreferences userInfo;//w  w w  . j  a  va  2s .  c o m
    try {
        userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE);
        return userInfo.getAll();
    } catch (NullPointerException e) {
        return null;
    }
}

From source file:Main.java

public static String ReadSharedPreferencesString(Context context, String name, String key,
        String defaultvalue) {/*from ww  w  .  j  a v a 2 s  .  com*/
    try {
        SharedPreferences userInfo = context.getSharedPreferences(name, Context.MODE_WORLD_READABLE);
        return userInfo.getString(key, defaultvalue);
    } catch (NullPointerException e) {
        e.printStackTrace();
        return null;
    }
}