I created an app in which a user will enter words that i want to store in an array. When the user closes the app i want this array to be written to a file for when they open the app again they don't have to reenter the words.
This is my first app and figured this wouldn't be that hard but i've been struggling to find this information online. I did find there are several places to save a file. I know that this list won't be too big and no other apps need access to this list, so i planned on saving it in the app specific internal storage location. I'm also programing in Kotlin.
During my research i saw there is a onPause( ), onStop( ), and onDestroy( ). However, i'm not sure how to have the file save based on a user swiping the app away. Do i create a function and have it save the file, then do something along the lines of if onStop( ) run my function to save file?
This is my first app and figured this wouldn't be that hard but i've been struggling to find this information online. I did find there are several places to save a file. I know that this list won't be too big and no other apps need access to this list, so i planned on saving it in the app specific internal storage location. I'm also programing in Kotlin.
During my research i saw there is a onPause( ), onStop( ), and onDestroy( ). However, i'm not sure how to have the file save based on a user swiping the app away. Do i create a function and have it save the file, then do something along the lines of if onStop( ) run my function to save file?