Search code examples
androidkotlinsaving-data

How can I save user input on their device using Kotlin?


I have an app that records user inputs in EditTexts and then displays them in the second activity as a textView. However every time I close the app, those text fields reset. How could I save user input so that it will stay, even when the app is closed? Also, is there a way to reset the app with empty EditTexts every 24 hours.


Solution

    • Option 1: You can use SharedPreferences or DataStore
    • Option 2: Use local databases like SQLite (you can use Room)