android中的数据存储类型包括:内存,普通文件,Shared Preferences,XML和SQLLite等

文件操作:

包括读写

/** * 【文件操作】 */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 *【文件读,写】 */public class FileOperate{   /**  * 【读取文件】  * @param context  * @param fileName  * @return  */ public String ReadText(Context context,String fileName) {       FileInputStream fIn = null;       InputStreamReader isr = null;             char[] inputBuffer = new char[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;   }  /**  * 【写入文件】  * @param context  * @param fileName  * @param data  */ public void WriteText(Context 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();                 }           }  }}

关于android操作sdcard的细节,详看

http://www.ylmf.net/zhuanti/zt02/2010/1130/12389.html

接下来是共享参数的操作,这个适合于将一些配置信息存储到这个位置上,可以存储小量的数据

http://www.cnblogs.com/over140/archive/2011/01/13/1934301.html

介绍的很详细

接下来是android操作关于sqllite的操作,

http://www.cnblogs.com/TerryBlog/archive/2010/06/12/1757166.html

连示例都有了,可以下来测试

然后是内容提供访问者ContentProvider

主要是用到多个程序之间对外提供一个可访问的接口,通过统一的uri对外提供访问

http://www.cnblogs.com/linzheng/archive/2011/01/22/1942101.html

更多相关文章

  1. Android使用系统分享文件给微信,QQ指定的用户
  2. Android文件下载使用Http协议
  3. 用Javascript判断访问来源操作系统, 设备, 浏览器类型
  4. ReactNative 命令生成bundle文件
  5. Android 手机存储文件各种路径
  6. 修改android studio 默认的so文件检索路径
  7. Android环境变量作用--命令行操作
  8. CreateProcess error=2, 系统找不到指定的文件。

随机推荐

  1. Android最新面试题汇总 持续更新
  2. Android之如何判断定位是否开启及定位模
  3. 【Android 内存优化】Bitmap 硬盘缓存 (
  4. 4.1 Android如何访问资源
  5. Android多媒体分析(一)MediaScanner
  6. Android.自定义控件的实现
  7. android 广播机制
  8. android usb挂载分析--ntfs-3g移植
  9. Android一套代码适配不同Android版本终极
  10. 用c/c++混合编程方式为ios/android实现一