Shared preference in kotlin
I have a error when I try to create a SharedPreference.
My variable sp is always equal null.
I attach my code:
fun saveParameter(){
val sp = getApplicationContext().getSharedPreferences("com.example.user.pocketandroid", Context.MODE_PRIVATE)
val editSp = sp.edit()
editSp.putInt(PORTTEXT,portText.text.toString().toInt())
editSp.putString(PASSWORDTEXT,passwordText.text.toString())
editSp.putString(NAMETEXT,nameText.text.toString())...