This library support these extensions, which are below:
The Extension is convenient to use ,we just look at how to call the SharePreference example,for the other examples ,you can click the link above to look their detail information.
"key1".getSPString()
"key2".getSPBoolean()
"key3".getSPFloat()
"key4".getSPInt()
"key5".getSPLong()
"key1".putSPString("Hello")
"key2".putSPBoolean(false)
"key3".putSPFloat(1.2f)
"key4".putSPInt(12)
"key5".putSPLong(2323L)
So easy!
In the build.gradle of the project root. Add code as following:
allprojects {
repositories {
//others
maven {
url "https://jitpack.io"
}
}
}
In the build.gradle
of the using module.
dependencies {
//others
implementation 'com.github.nb312:Kotlin-Extension:0.0.9'
}
You must init the param in your application:
NBExtensionUtil.context = this
Then you can use them happy.