Sobes.tech
Junior — Middle

Milline sisseehitatud andmete salvestuslahendus on Androidis vaikimisi kasutusel?

sobes.tech AI

Vastus AI-lt

Defaultly, in Android, SharedPreferences is used for storing simple data. It is an built-in mechanism that allows saving key-value pairs in XML files accessible to the application. SharedPreferences is suitable for storing settings, flags, and small volumes of data.

Usage example:

val sharedPref = context.getSharedPreferences("MyPrefs", Context.MODE_PRIVATE)
sharedPref.edit().putString("username", "user123").apply()
val username = sharedPref.getString("username", "defaultUser")