Java Code Examples for android.content.ContextWrapper#MODE_MULTI_PROCESS

The following examples show how to use android.content.ContextWrapper#MODE_MULTI_PROCESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Prefs.java    From PS4-Payload-Sender-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Set the mode of the sharedpreference instance.
 *
 * @param mode Operating mode.  Use 0 or {@link Context#MODE_PRIVATE} for the
 *             default operation, {@link Context#MODE_WORLD_READABLE}
 * @return the {@link com.pixplicity.easyprefs.library.Prefs.Builder} object.
 * @see Context#getSharedPreferences
 */
public Builder setMode(final int mode) {
    if (mode == ContextWrapper.MODE_PRIVATE || mode == ContextWrapper.MODE_WORLD_READABLE || mode == ContextWrapper.MODE_WORLD_WRITEABLE || mode == ContextWrapper.MODE_MULTI_PROCESS) {
        mMode = mode;
    } else {
        throw new RuntimeException("The mode in the sharedpreference can only be set too ContextWrapper.MODE_PRIVATE, ContextWrapper.MODE_WORLD_READABLE, ContextWrapper.MODE_WORLD_WRITEABLE or ContextWrapper.MODE_MULTI_PROCESS");
    }

    return this;
}
 
Example 2
Source File: Prefs.java    From EasyPrefs with Apache License 2.0 5 votes vote down vote up
/**
 * Set the mode of the SharedPreference instance.
 *
 * @param mode Operating mode.  Use 0 or {@link Context#MODE_PRIVATE} for the
 *             default operation, {@link Context#MODE_WORLD_READABLE}
 * @return the {@link com.pixplicity.easyprefs.library.Prefs.Builder} object.
 * @see Context#getSharedPreferences
 */
@SuppressLint({"WorldReadableFiles", "WorldWriteableFiles"})
public Builder setMode(final int mode) {
    if (mode == ContextWrapper.MODE_PRIVATE || mode == ContextWrapper.MODE_WORLD_READABLE || mode == ContextWrapper.MODE_WORLD_WRITEABLE || mode == ContextWrapper.MODE_MULTI_PROCESS) {
        mMode = mode;
    } else {
        throw new RuntimeException("The mode in the SharedPreference can only be set too ContextWrapper.MODE_PRIVATE, ContextWrapper.MODE_WORLD_READABLE, ContextWrapper.MODE_WORLD_WRITEABLE or ContextWrapper.MODE_MULTI_PROCESS");
    }

    return this;
}