How do I recreate the activity only once after opening the application?
I tried to do this, but it didn't work. Endlessly recreate()
refreshLang() in onCreate
private fun refreshLang() {
PreferenceManager.getDefaultSharedPreferences(this).apply {
val checkRun = getString("FIRSTRUN", "DEFAULT")
if (checkRun == "YES") {
PreferenceManager.getDefaultSharedPreferences(this@MainActivity).edit().putString("FIRSTRUN", "NO").apply()
recreate()
}
}
}
and SharPref.putString("FIRSTRUN", "YES").apply() in onDestroy to make it work again the next time you run it.