简体   繁体   中英

Android:How to save application Data to phone memory in file and then retrieve it back?

I am new to android and am trying to develop some basic SMS application. Now, I have two fields one for phone number and other for message, I would like to store these fields in a file and when a user hits the load button I want it to pop back in the respected fields. I tried using

fos.write (msg.getBytes());(fos = fileoutputstream), 

but it does not seem to work.

Now, I have two fields one for phone number and other for message, I would like to store these fields in a file and when a user hits the load button I want it to pop back in the respected fields.

You should use shared preferences for that.

It sounds like it would be worthwhile for you to store it in a datastore-- http://developer.android.com/guide/topics/data/data-storage.html for more info.

It might also be helpful to walk through the Notepad tutorial: http://developer.android.com/resources/tutorials/notepad/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM