Data Storage types in Android include memory, common files, shared preferences, XML, and sqllite.
File Operations:
Including read/write
/*** [File operation] */package iwit. iwittest; import Java. io. fileinputstream; import Java. io. fileoutputstream; import Java. io. ioexception; import Java. io. inputstreamreader; import Java. io. outputstreamwriter; import android. content. context; import android. widget. toast;/*** @ author shine * [file read, write] */public class fileoperate {/*** [Read File] * @ Param context * @ Param filename * @ return */Public String readtext (context, string filename) {fileinputstream fin = NULL; inputstreamreader ISR = NULL; char [] inputbuffer = new char [0, 255]; string data = NULL; try {fin = context. openfileinput (filename); ISR = new inputstreamreader (FIN); ISR. read (inputbuffer); Data = new string (inputbuffer); toast. maketext (context, "Read succeed", toast. length_short ). show ();} catch (exception e) {e. printstacktrace (); toast. maketext (context, "not read", toast. length_short ). show () ;}finally {try {ISR. close (); Fin. close ();} catch (ioexception e) {e. printstacktrace () ;}} return data;}/*** [Write File] * @ Param context * @ Param filename * @ Param data */Public void writetext (context, string filename, string data) {fileoutputstream fout = NULL; outputstreamwriter OSW = NULL; try {fout = context. openfileoutput (filename, 1); OSW = new outputstreamwriter (fout); OSW. write (data); OSW. flush (); toast. maketext (context, "saved", toast. length_short ). show ();} catch (exception e) {e. printstacktrace (); toast. maketext (context, "not saved", toast. length_short ). show () ;}finally {try {OSW. close (); fout. close ();} catch (ioexception e) {e. printstacktrace ();}}}}
For details about how to operate sdcard on Android, see
Http://www.ylmf.net/zhuanti/zt02/2010/1130/12389.html
The next step is to share the parameter operation, which is suitable for storing some configuration information to this location and storing a small amount of data.
Http://www.cnblogs.com/over140/archive/2011/01/13/1934301.html
Detailed introduction
Next, perform sqllite operations on Android,
Http://www.cnblogs.com/TerryBlog/archive/2010/06/12/1757166.html
Even the examples are available. You can test them.
Then the content provides the visitor contentprovider
It mainly uses multipleProgramProvides an externally accessible interface through a uniform Uri.
Http://www.cnblogs.com/linzheng/archive/2011/01/22/1942101.html