【转载】Android 软件开发之数据的 新建 储存 读取 删除 详解(十四)

来源:互联网 发布:淘宝模特拍摄的业务 编辑:程序博客网 时间:2024/05/17 19:58

【转载】本文出自 “雨松MOMO的程序世界” 博客,请务必保留此出处http://xys289187120.blog.51cto.com/3361352/657020            

 

1.使用SharedPreferences处理数据的 新建 储存 读取 删除
 
SharedPreferences保存后生成的是XML文件,内容是以节点的形势保存在文件中,SharedPreferences类提供了非常丰富的处理数据的方法下面我向大家介绍一下如何使用SharedPreferences来处理数据。

输入须要保存的内容 

 

输入姓名:雨松MOMO
输入号码:15810463139


 

点击保存成功

  

保存成功以后,数据被保存到了data路径下 /当前包名 (红框内的包名是我的程序包名) /shared_prefs/main.xml中 , 使用EditPlus 打开保存的内容,我们可以清晰的看到内容是以一个节点一个节点的形式存在XML中。 

SharedPreferences类中提供了非常方便方法去保存数据与读取数据大家请看下面的代码片段,一个程序中可以存在多个SharedPreferences保存的XML文件 ,代码中只须要根据不同的XML名称就可以通过方法拿到相应的对象,由于它的批量遍历查找,当然这样的作法肯定没有数据库更方便快捷,所以在开发中处理一些比较小的零碎的数据就可以保存在这里,比如说记录软件中用户设置的音量大小,用户输入的查找信息等等都可以存在SharedPreferences中。
 
  1. public class SPActivity extends Activity {  
  2.      
  3.     /**使用SharedPreferences 来储存与读取数据**/  
  4.     SharedPreferences mShared = null;  
  5.  
  6.     /**程序中可以同时存在多个SharedPreferences数据, 根据SharedPreferences的名称就可以拿到对象**/  
  7.     public final static String SHARED_MAIN = "main";  
  8.      
  9.     /**SharedPreferences中储存数据的Key名称**/  
  10.     public final static String KEY_NAME = "name";  
  11.     public final static String KEY_NUMBER = "number";  
  12.       
  13.     /**SharedPreferences中储存数据的路径**/  
  14.     public final static String DATA_URL = "/data/data/";  
  15.     public final static String SHARED_MAIN_XML = "main.xml";  
  16.       
  17.       
  18.     @Override  
  19.     protected void onCreate(Bundle savedInstanceState) {  
  20.     setContentView(R.layout.sharedpreferences);  
  21.     /**拿到名称是SHARED_MAIN 的SharedPreferences对象**/  
  22.     mShared = getSharedPreferences(SHARED_MAIN, Context.MODE_PRIVATE);  
  23.     /**拿到SharedPreferences中保存的数值 第二个参数为如果SharedPreferences中没有保存就赋一个默认值**/  
  24.     String name = mShared.getString(KEY_NAME, "数据库中没有储存姓名");  
  25.     String number = mShared.getString(KEY_NUMBER, "数据库中没有储存号码");  
  26.       
  27.     final EditText editName = (EditText)findViewById(R.id.sp_et0);  
  28.     final EditText editNumber = (EditText)findViewById(R.id.sp_et1);  
  29.     editName.setHint("上次输入的姓名为【 " +name+"】");  
  30.     editNumber.setHint("上次输入的号码为【 " +number+"】");  
  31.       
  32.     Button button0 = (Button)findViewById(R.id.sp_button0);  
  33.       
  34.     /**监听按钮点击后保存用户输入信息到SharedPreferences中**/  
  35.     button0.setOnClickListener(new  OnClickListener() {  
  36.           
  37.         @Override  
  38.         public void onClick(View arg0) {  
  39.         /**拿到用户输入的信息**/  
  40.         String name = editName.getText().toString();  
  41.         String number = editNumber.getText().toString();  
  42.         /**开始保存入SharedPreferences**/  
  43.         Editor editor = mShared.edit();  
  44.         editor.putString(KEY_NAME, name);  
  45.         editor.putString(KEY_NUMBER, number);  
  46.         /**put完毕必需要commit()否则无法保存**/  
  47.         editor.commit();  
  48.         ShowDialog("保存SharedPreferences成功");  
  49.           
  50.         }  
  51.     });  
  52.       
  53.     Button button1 = (Button)findViewById(R.id.sp_button1);  
  54.     button1.setOnClickListener(new  OnClickListener() {  
  55.           
  56.         @Override  
  57.         public void onClick(View arg0) {  
  58.         /**开始清除SharedPreferences中保存的内容**/  
  59.         Editor editor = mShared.edit();  
  60.         editor.remove(KEY_NAME);  
  61.         editor.remove(KEY_NUMBER);  
  62.         //editor.clear();  
  63.         editor.commit();  
  64.         ShowDialog("清除SharedPreferences数据成功");  
  65.         }  
  66.     });  
  67.       
  68.     Button button2 = (Button)findViewById(R.id.sp_button2);  
  69.     button2.setOnClickListener(new OnClickListener() {  
  70.  
  71.         @Override  
  72.         public void onClick(View arg0) {  
  73.         /** 删除SharedPreferences文件 **/  
  74.         File file = new File(DATA_URL + getPackageName().toString()  
  75.             + "/shared_prefs", SHARED_MAIN_XML);  
  76.         if (file.exists()) {  
  77.             file.delete();  
  78.         }  
  79.         ShowDialog("删除SharedPreferences文件成功");  
  80.         }  
  81.     });  
  82.       
  83.       
  84.     super.onCreate(savedInstanceState);  
  85.     }  
  86.  
  87.     public void ShowDialog(String string) {  
  88.     AlertDialog.Builder builder = new AlertDialog.Builder(SPActivity.this);  
  89.     builder.setIcon(R.drawable.icon);  
  90.     builder.setTitle(string);  
  91.     builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {  
  92.         public void onClick(DialogInterface dialog, int whichButton) {  
  93.         finish();  
  94.         }  
  95.     });  
  96.     builder.show();  
  97.     }  
  98. }  
  1. <?xml version="1.0" encoding="utf-8"?> 
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  4.     android:layout_width="fill_parent"   
  5.     android:layout_height="fill_parent" 
  6.     android:orientation="vertical" 
  7.     > 
  8.     <ImageView android:id="@+id/sp_image" 
  9.         android:layout_width="wrap_content" 
  10.          android:layout_height="wrap_content" 
  11.         android:src="@drawable/image" 
  12.         android:layout_gravity="center" 
  13.         /> 
  14.     <EditText android:id="@+id/sp_et0" 
  15.               android:layout_width="fill_parent" 
  16.               android:layout_height="wrap_content" 
  17.               android:hint="请输入你的姓名"> 
  18.     </EditText> 
  19.     <EditText android:id="@+id/sp_et1" 
  20.               android:layout_width="fill_parent" 
  21.               android:layout_height="wrap_content" 
  22.               android:hint="请输入你的号码"> 
  23.     </EditText> 
  24.     <Button   android:id="@+id/sp_button0" 
  25.               android:layout_width="wrap_content" 
  26.               android:layout_height="wrap_content" 
  27.               android:text="保存输入内容shared"> 
  28.     </Button> 
  29.     <Button   android:id="@+id/sp_button1" 
  30.               android:layout_width="wrap_content" 
  31.               android:layout_height="wrap_content" 
  32.               android:text="清除shared保存内容"> 
  33.     </Button> 
  34.     <Button   android:id="@+id/sp_button2" 
  35.               android:layout_width="wrap_content" 
  36.               android:layout_height="wrap_content" 
  37.               android:text="删除shared文件"> 
  38.     </Button> 
  39. </LinearLayout> 
2.在本地data文件下使用自己生成的文件处理数据的 新建 储存 读取 删除
如果说不想把内容存在SharedPreferences中的话,我们可以自己写一个文件保存须要的数据,在这里我将文件保存在系统中的工程路径下。
 
输入需要保存的内容

保存完毕后红框内呈现之前保存的数据

保存文件以后,文件被保存在了当前工程下 files 文件夹的路径下,这里说一下data文件夹 如果手机没有root 权限 用户是访问不到的,这种储存方式有一个麻烦的地方就是文件中保存的数据须要程序员自己去处理 , 好比文件中保存了很多字符串数据 但是我们只须要其中的一部分数据,这样就须要自己去写代码去从文件中拿需要的数据。

 
  1. public class FileActivity extends Activity {  
  2.     public final static String FILE_NAME = "a.txt";  
  3.      
  4.     /**File中储存数据的路径**/  
  5.     public final static String DATA_URL = "/data/data/";  
  6.     @Override  
  7.     protected void onCreate(Bundle savedInstanceState) {  
  8.     setContentView(R.layout.file);  
  9.     /**读取内容**/  
  10.     String content = loadFile();  
  11.     if(content == null) {  
  12.         content ="上次没有输入内容请输入";   
  13.     }  
  14.      String str  = "上次输入保存的内容的姓名为【 " +content + "】";  
  15.     final EditText editContent = ((EditText)findViewById(R.id.file_et0));  
  16.     editContent.setHint(str);  
  17.     Button button0 = (Button)findViewById(R.id.file_button0);  
  18.       
  19.     /**监听按钮点击后保存用户输入信息到file中**/  
  20.     button0.setOnClickListener(new  OnClickListener() {  
  21.         @Override  
  22.         public void onClick(View arg0) {  
  23.         /**拿到用户输入的信息**/  
  24.         String content = editContent.getText().toString();  
  25.         /**开始保存入file**/  
  26.         saveFile(content);  
  27.         ShowDialog("保存File文件成功");  
  28.         }  
  29.     });  
  30.       
  31.     Button button1 = (Button)findViewById(R.id.file_button1);  
  32.     /**监听按钮点击后清空file中内容**/  
  33.     button1.setOnClickListener(new  OnClickListener() {  
  34.         @Override  
  35.         public void onClick(View arg0) {  
  36.         cleanFile();  
  37.         ShowDialog("清空File文件成功");  
  38.         }  
  39.     });  
  40.       
  41.     Button button2 = (Button)findViewById(R.id.file_button2);  
  42.       
  43.     /**监听按钮点击后删除file文件**/  
  44.     button2.setOnClickListener(new  OnClickListener() {  
  45.         @Override  
  46.         public void onClick(View arg0) {  
  47.         File file = new File(DATA_URL + getPackageName().toString()  
  48.             + "/files", FILE_NAME);  
  49.         if (file.exists()) {  
  50.             file.delete();  
  51.         }  
  52.         ShowDialog("删除file文件成功");  
  53.         }  
  54.     });  
  55.       
  56.     super.onCreate(savedInstanceState);  
  57.     }  
  58.       
  59.     /**  
  60.      * 保存内容  
  61.      * @param str  
  62.      */  
  63.     public void saveFile(String str) {  
  64.     try {  
  65.         FileOutputStream outStream = this.openFileOutput(FILE_NAME,  
  66.             Context.MODE_WORLD_READABLE);  
  67.         outStream.write(str.getBytes());  
  68.         outStream.close();  
  69.     } catch (FileNotFoundException e) {  
  70.     } catch (IOException e) {  
  71.     }  
  72.     }  
  73.    
  74.     /**  
  75.      * 因为java删除文件内容只有一种实现方法,就是把整个文件重写,只是把须要删除的那一条记录去除掉   
  76.      */  
  77.     public void cleanFile() {  
  78.     //如果只须要删除文件中的一部分内容则须要在这里对字符串做一些操作  
  79.     String cleanStr = "";  
  80.     try {  
  81.         FileOutputStream outStream = this.openFileOutput(FILE_NAME,  
  82.             Context.MODE_WORLD_READABLE);  
  83.         outStream.write(cleanStr.getBytes());  
  84.         outStream.close();  
  85.     } catch (FileNotFoundException e) {  
  86.     } catch (IOException e) {  
  87.     }  
  88.  
  89.     }  
  90.       
  91.  
  92.       
  93.       
  94.     public String loadFile() {  
  95.     try {  
  96.         FileInputStream inStream = this.openFileInput(FILE_NAME);  
  97.         ByteArrayOutputStream stream = new ByteArrayOutputStream();  
  98.         byte[] buffer = new byte[1024];  
  99.         int length = -1;  
  100.         while ((length = inStream.read(buffer)) != -1) {  
  101.         stream.write(buffer, 0, length);  
  102.         }  
  103.         stream.close();  
  104.         inStream.close();  
  105.         return stream.toString();  
  106.     } catch (FileNotFoundException e) {  
  107.         e.printStackTrace();  
  108.     } catch (IOException e) {  
  109.     }  
  110.     return null;  
  111.     }  
  112.       
  113.     public void ShowDialog(String str) {  
  114.     AlertDialog.Builder builder = new AlertDialog.Builder(FileActivity.this);  
  115.     builder.setIcon(R.drawable.icon);  
  116.     builder.setTitle(str);  
  117.     builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {  
  118.         public void onClick(DialogInterface dialog, int whichButton) {  
  119.         finish();  
  120.         }  
  121.     });  
  122.     builder.show();  
  123.     }  
  124. }  
 
  1. <?xml version="1.0" encoding="utf-8"?> 
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  4.     android:layout_width="fill_parent"   
  5.     android:layout_height="fill_parent" 
  6.     android:orientation="vertical" 
  7.     > 
  8.     <ImageView android:id="@+id/file_image" 
  9.         android:layout_width="wrap_content" 
  10.          android:layout_height="wrap_content" 
  11.         android:src="@drawable/jay" 
  12.         android:layout_gravity="center" 
  13.         /> 
  14.       
  15.     <EditText android:id="@+id/file_et0" 
  16.               android:layout_width="fill_parent" 
  17.               android:layout_height="wrap_content" 
  18.               android:hint="请输入需要保存的内容"> 
  19.     </EditText> 
  20.     <Button   android:id="@+id/file_button0" 
  21.               android:layout_width="wrap_content" 
  22.               android:layout_height="wrap_content" 
  23.               android:text="保存入file"> 
  24.     </Button> 
  25.     <Button   android:id="@+id/file_button1" 
  26.               android:layout_width="wrap_content" 
  27.               android:layout_height="wrap_content" 
  28.               android:text="清除file保存内容"> 
  29.     </Button> 
  30.     <Button   android:id="@+id/file_button2" 
  31.               android:layout_width="wrap_content" 
  32.               android:layout_height="wrap_content" 
  33.               android:text="删除file文件"> 
  34.     </Button> 
  35. </LinearLayout> 
3.在本地程序res/raw中读取数据操作
Android 下提供了专门读取程序res/raw路径下资源的方法,但是没有提供写入raw内容的方法,也就是说只能读不能写,在做软件的时候有时须要读取大量的文字资源,由于这些资源文字在软件中不会改变所以无需去对它的内容重写修改,就可以使用raw来操作数据。

如图所示:在列表中读取.bin文件中的内容分别显示在listView中


 
如图所示在raw路径下存了一个文件date0.bin ,下面是bin文件中保存的内容,程序中须要对这个.bin文件的内容进行读取并显示在屏幕中。 


下面给出代码的实现

  1. public class loadRawActivity extends ListActivity {  
  2.  
  3.     private class MyListAdapter extends BaseAdapter {  
  4.     private int[] colors = new int[] { 0xff626569, 0xff4f5257 };  
  5.  
  6.     public MyListAdapter(Context context) {  
  7.         mContext = context;  
  8.     }  
  9.  
  10.     public int getCount() {  
  11.         return inpormation.length;  
  12.     }  
  13.  
  14.     @Override  
  15.     public boolean areAllItemsEnabled() {  
  16.         return false;  
  17.     }  
  18.  
  19.     public Object getItem(int position) {  
  20.         return position;  
  21.     }  
  22.  
  23.     public long getItemId(int position) {  
  24.         return position;  
  25.     }  
  26.  
  27.     public View getView(int position, View convertView, ViewGroup parent) {  
  28.         TextView tv;  
  29.         if (convertView == null) {  
  30.         tv = (TextView) LayoutInflater.from(mContext).inflate(  
  31.             android.R.layout.simple_list_item_1, parent, false);  
  32.         } else {  
  33.         tv = (TextView) convertView;  
  34.         }  
  35.         int colorPos = position % colors.length;  
  36.         tv.setBackgroundColor(colors[colorPos]);  
  37.         tv.setText(String.valueOf(position + 1) + ":"  
  38.             + inpormation[position]);  
  39.         return tv;  
  40.     }  
  41.  
  42.     private Context mContext;  
  43.     }  
  44.  
  45.     String[] inpormation = null;  
  46.     ListView listView;  
  47.  
  48.     @Override  
  49.     protected void onCreate(Bundle savedInstanceState) {  
  50.     readFile(R.raw.date0);  
  51.     setListAdapter(new MyListAdapter(this));  
  52.     listView = getListView();  
  53.     int[] colors = { 0, 0xFF505259, 0 };   
  54.     listView  
  55.         .setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));  
  56.     listView.setDividerHeight(10);  
  57.     super.onCreate(savedInstanceState);  
  58.     }  
  59.  
  60.     /**  
  61.      * 从raw中读取数据  
  62.      * @param ID  
  63.      */  
  64.     public void readFile(int ID) {  
  65.     InputStream in = null;  
  66.     String temp = "";  
  67.     try {  
  68.         in = this.getResources().openRawResource(ID);  
  69.         byte[] buff = new byte[1024];// 缓存  
  70.         int rd = 0;  
  71.         ByteArrayOutputStream baos = new ByteArrayOutputStream();  
  72.         while ((rd = in.read(buff)) != -1) {  
  73.         baos.write(buff, 0, rd);  
  74.         temp = new String(baos.toByteArray(), "UTF-8");  
  75.         }  
  76.         baos.close();  
  77.         in.close();  
  78.         inpormation = temp.split("\r\n");  
  79.     } catch (Exception e) {  
  80.         Toast.makeText(this, "文件没有找到", 2000).show();  
  81.     }  
  82.     }  
  83.  

3.在SD卡中处理新建 写入 读取 删除 的操作

可以把数据保存在SD卡中,在SD卡中建立一个文件去保存数据,这里说一下 ,SD卡 用户是可以访问的,也就是说可以把一些可有可无的数据存在SD卡中,即使用户删除了卡中的内容也不会影像软件的使用。 

将文件在SD卡中删除 

  1. public class loadSDActivity extends Activity {  
  2.     public final static String FILE_NAME = "b.txt";  
  3.     @Override  
  4.     protected void onCreate(Bundle savedInstanceState) {  
  5.     setContentView(R.layout.sdfile);  
  6.     /**读取内容**/  
  7.     String content = loadFile();  
  8.     if(content == null) {  
  9.         content ="上次没有输入内容请输入";   
  10.     }  
  11.       
  12.     final EditText editContent = (EditText)findViewById(R.id.sdfile_et0);  
  13.     editContent.setHint("上次输入SD卡的内容的为【 " +content + "】");  
  14.     Button button0 = (Button)findViewById(R.id.sdfile_button0);  
  15.       
  16.     /**监听按钮点击后保存用户输入信息到SD卡中**/  
  17.     button0.setOnClickListener(new  OnClickListener() {  
  18.           
  19.         @Override  
  20.         public void onClick(View arg0) {  
  21.         /**拿到用户输入的信息**/  
  22.         String content = editContent.getText().toString();  
  23.         /**开始保存入SD卡**/  
  24.         saveFile(content);  
  25.         ShowDialog("保存SD卡文件成功");  
  26.         }  
  27.     });  
  28.     Button button1 = (Button)findViewById(R.id.sdfile_button1);  
  29.       
  30.     /**去清除SD卡保存的内容**/  
  31.     button1.setOnClickListener(new  OnClickListener() {  
  32.         @Override  
  33.         public void onClick(View arg0) {  
  34.         cleanFile();  
  35.         ShowDialog("清除SD卡文件中的内容成功");  
  36.         }  
  37.     });   
  38.     Button button2 = (Button)findViewById(R.id.sdfile_button2);  
  39.       
  40.     /**删除SD卡保存的文件**/  
  41.     button2.setOnClickListener(new  OnClickListener() {  
  42.         @Override  
  43.         public void onClick(View arg0) {  
  44.         DeleteSDFile();  
  45.         }  
  46.     });  
  47.       
  48.     super.onCreate(savedInstanceState);  
  49.     }  
  50.       
  51.     /**  
  52.      * 保存入SD卡中  
  53.      * @param str  
  54.      */  
  55.     public void saveFile(String str) {  
  56.     FileOutputStream fileOutputStream = null;  
  57.  
  58.     File file = new File(Environment.getExternalStorageDirectory(),  
  59.         FILE_NAME);  
  60.     try {  
  61.         fileOutputStream = new FileOutputStream(file);  
  62.         fileOutputStream.write(str.getBytes());  
  63.         fileOutputStream.close();  
  64.     } catch (FileNotFoundException e) {  
  65.         e.printStackTrace();  
  66.     }catch (IOException e) {  
  67.         e.printStackTrace();  
  68.     }  
  69.     }  
  70.      
  71.       
  72.     /**  
  73.      * 读取SD卡的内容  
  74.      * @return  
  75.      */  
  76.     public String loadFile() {  
  77.     String path = Environment.getExternalStorageDirectory() +"/" + FILE_NAME;  
  78.     try {  
  79.  
  80.         FileInputStream fi = new FileInputStream(path);  
  81.         BufferedReader br = new BufferedReader(new InputStreamReader(  
  82.             fi));  
  83.         String readString = new String();  
  84.         while ((readString = br.readLine()) != null) {  
  85.         //数据多的话须要在这里处理 readString  
  86.         return readString;  
  87.         }  
  88.         fi.close();  
  89.     } catch (FileNotFoundException e) {  
  90.         e.printStackTrace();  
  91.     } catch (IOException e) {  
  92.         e.printStackTrace();  
  93.     }  
  94.  
  95.     return null;  
  96.     }  
  97.       
  98.     /**  
  99.      * 删除SD卡  
  100.      */  
  101.     public void DeleteSDFile() {  
  102.     String path = Environment.getExternalStorageDirectory() + "/"  
  103.         + FILE_NAME;  
  104.     File file1 = new File(path);  
  105.     boolean isdelte = file1.delete();  
  106.     if(isdelte) {  
  107.         ShowDialog("删除SD卡成功");  
  108.     }else {  
  109.         finish();  
  110.     }  
  111.     }  
  112.       
  113.     /**  
  114.      * 因为java删除文件内容只有一种实现方法,就是把整个文件重写,只是把须要删除的那一条记录去除掉   
  115.      */  
  116.     public void cleanFile() {  
  117.     //如果只须要删除文件中的一部分内容则须要在这里对字符串做一些操作  
  118.     String cleanStr = "";  
  119.     FileOutputStream fileOutputStream = null;  
  120.  
  121.     File file = new File(Environment.getExternalStorageDirectory(),  
  122.         FILE_NAME);  
  123.     try {  
  124.         fileOutputStream = new FileOutputStream(file);  
  125.         fileOutputStream.write(cleanStr.getBytes());  
  126.         fileOutputStream.close();  
  127.     } catch (FileNotFoundException e) {  
  128.         e.printStackTrace();  
  129.     }catch (IOException e) {  
  130.         e.printStackTrace();  
  131.     }  
  132.     }  
  133.     public void ShowDialog(String str) {  
  134.     AlertDialog.Builder builder = new AlertDialog.Builder(loadSDActivity.this);  
  135.     builder.setIcon(R.drawable.icon);  
  136.     builder.setTitle(str);  
  137.     builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {  
  138.         public void onClick(DialogInterface dialog, int whichButton) {  
  139.         finish();  
  140.         }  
  141.     });  
  142.     builder.show();  
  143.     }  
  1. <?xml version="1.0" encoding="utf-8"?> 
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  4.     android:layout_width="fill_parent"   
  5.     android:layout_height="fill_parent" 
  6.     android:orientation="vertical" 
  7.     > 
  8.     <ImageView android:id="@+id/sdfile_image" 
  9.         android:layout_width="wrap_content" 
  10.          android:layout_height="wrap_content" 
  11.         android:src="@drawable/g" 
  12.         android:layout_gravity="center" 
  13.         /> 
  14.     <EditText android:id="@+id/sdfile_et0" 
  15.               android:layout_width="fill_parent" 
  16.               android:layout_height="wrap_content" 
  17.               android:hint="请输入需要保存到SD卡的内容"> 
  18.     </EditText> 
  19.     <Button   android:id="@+id/sdfile_button0" 
  20.               android:layout_width="wrap_content" 
  21.               android:layout_height="wrap_content" 
  22.               android:text="保存输入内容到SD卡"> 
  23.     </Button> 
  24.     <Button   android:id="@+id/sdfile_button1" 
  25.               android:layout_width="wrap_content" 
  26.               android:layout_height="wrap_content" 
  27.               android:text="清除SD卡保存文件的内容"> 
  28.     </Button> 
  29.     <Button   android:id="@+id/sdfile_button2" 
  30.               android:layout_width="wrap_content" 
  31.               android:layout_height="wrap_content" 
  32.               android:text="删除SD卡中保存的文件"> 
  33.     </Button> 
  34. </LinearLayout> 
最近有朋友反映下载资源不够积分,无法下载很着急,从今天开始雨松MOMO更新的任何下载资源不会使用下载积分,欢迎大家下载阅读,还是那句老话每篇文章都会附带源代码的下载地址。

最后如果你还是觉得我写的不够详细 看的不够爽 不要紧我把源代码的下载地址贴出来 欢迎大家一起讨论学习雨松MOMO希望可以和大家一起进步。


下载地址:http://download.csdn.net/source/3480252

本文出自 “雨松MOMO的程序世界” 博客,请务必保留此出处http://xys289187120.blog.51cto.com/3361352/657020

0 0