Check out example codes for "set preference value android". It will help you in understanding the concepts better.

Code Example 1

boolean committed = PreferenceManager.getDefaultSharedPreferences(yourContext).edit().putBoolean(key, mValue).commit();
//you can also use putInt, putFloat, putLong, putString, putStringSet and change the value of mValue
//committed is true if everything went alright, false if there was an error

Learn ReactJs, React Native from