android.content.SharedPreferences.Editor putBoolean() is a method in Android that is used to add a boolean value in the specified preference editor. The method takes two arguments:
1. The key name for the value that needs to be added. 2. The boolean value that needs to be added.
Example:
Suppose we want to add a boolean value to our preference editor with the key name 'isDarkTheme' and the boolean value as 'true'. We can do this using the putBoolean() method as shown below:
1. 'MyPrefs' is the name of our preference file. 2. MODE_PRIVATE is a constant that specifies the access level of our preference file.
Package/library: android.content
This method is a part of the Android SDK and does not require any external package or library.
Java SharedPreferences.Editor.putBoolean - 30 examples found. These are the top rated real world Java examples of android.content.SharedPreferences.Editor.putBoolean extracted from open source projects. You can rate examples to help us improve the quality of examples.