Skip to content

nb312/Kotlin-Extension

Repository files navigation

Kotlin-Extension

ex
This library support these extensions, which are below:

SharedPreferences Example

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.

Obtain the content with your key.

        "key1".getSPString()
        "key2".getSPBoolean()
        "key3".getSPFloat()
        "key4".getSPInt()
        "key5".getSPLong()

save content with your key

        "key1".putSPString("Hello")
        "key2".putSPBoolean(false)
        "key3".putSPFloat(1.2f)
        "key4".putSPInt(12)
        "key5".putSPLong(2323L)

So easy!

How to Start!

1. Add an URL of the repository

In the build.gradle of the project root. Add code as following:

allprojects {
    repositories {
        //others 
        maven {
            url "https://jitpack.io"
        }
       
    }
}

2. dependencies

In the build.gradle of the using module.

dependencies {
//others
     implementation 'com.github.nb312:Kotlin-Extension:0.0.9'
}

3. init

You must init the param in your application:

  NBExtensionUtil.context = this

Then you can use them happy.