Dev Preference Manager

class DevPreferenceManager(    context: Context,     prefName: String,     gson: Gson)

Class for preference manipulation

Author

Jimly A.

Since

01-Jun-20.

Parameters

context

the Context for preference

prefName

Preference's name for application

gson

for parsing object purposes

Constructors

Link copied to clipboard
fun DevPreferenceManager(    context: Context,     prefName: String,     gson: Gson)

create new preference manager instance

Functions

Link copied to clipboard
fun getBoolean(key: String, default: Boolean): Boolean

Method to get boolean from preference

Link copied to clipboard
fun getFloat(key: String, default: Float): Float

Method to get float from preference

Link copied to clipboard
fun getInt(key: String, default: Int): Int

Method to get int from preference

Link copied to clipboard
fun getLong(key: String, default: Long): Long

Method to get long from preference

Link copied to clipboard
fun <T> getObject(key: String, type: Class<T>): T?

Method to get object from preference

Link copied to clipboard
fun getString(key: String, default: String): String

Method to get string from preference

Link copied to clipboard
fun saveBoolean(key: String, value: Boolean)

Method to save boolean to preference

Link copied to clipboard
fun saveFloat(key: String, value: Float)

Method to save float to preference

Link copied to clipboard
fun saveInt(key: String, value: Int)

Method to save int to preference

Link copied to clipboard
fun saveLong(key: String, value: Long)

Method to save long to preference

Link copied to clipboard
fun saveObject(key: String, value: Any)

Method to save object to preference

Link copied to clipboard
fun saveString(key: String, value: String)

Method to save string to preference

Sources

Link copied to clipboard