亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

內存卡的數據保存與讀取

發布時間:2020-07-17 00:37:52 來源:網絡 閱讀:362 作者:lang螞蟻 欄目:軟件技術

,內存卡

     2.1數據保存

File file=new File(Environment.getExternalStorageDirectory(), name);

                                                  try {

                                                            FileOutputStream   fos=new FileOutputStream(file);

                                                            fos.write(content.getBytes());

                                                            fos.close();

                                                               Toast.makeText(getApplicationContext(), "保存成功", 200).show();

                                                  }  catch (Exception e) {

                                                               Toast.makeText(getApplicationContext(), "保存失敗", 200).show();

                                                            e.printStackTrace();

                                                  }

                     


 

2.2數據讀取

File file=new File(Environment.getExternalStorageDirectory(), name);

                                                  try {

                                                            FileOutputStream   fos=new FileOutputStream(file);

                                                            fos.write(content.getBytes());

                                                            fos.close();

                                                               Toast.makeText(getApplicationContext(), "保存成功", 200).show();

                                                  }  catch (Exception e) {

                                                               Toast.makeText(getApplicationContext(), "保存失敗", 200).show();

                                                            e.printStackTrace();

                                                  }


 


  3,sharedprefrence (****)

   

       btn_ok.setOnClickListener(new OnClickListener() {

                               

                              @Override

                              public void onClick(View v) {

                                         

                                                  String  user = et_user.getText().toString().trim();

                                                  String  pwd = et_pwd.getText().toString().trim();

                                                  if(user.isEmpty()||pwd.isEmpty()){

                                                            Toast.makeText(getApplicationContext(), "不能為空", 200).show();

                                                            //獲取編輯器

                                                     Editor edit = sp.edit();

                                                                 //保存數據

                                                     edit.putString("name", user);

                                                     edit.putString("pwd", pwd);

                                                     //提交保存

                                                     edit.commit();          

                                                  }                                        

                              }

                    });


 


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

莱西市| 唐河县| 隆昌县| 察雅县| 平定县| 崇义县| 临城县| 沾化县| 噶尔县| 建德市| 南昌市| 洛宁县| 涟源市| 三穗县| 丹阳市| 武陟县| 曲阜市| 咸宁市| 北安市| 施甸县| 乌拉特后旗| 龙海市| 五莲县| 惠安县| 东丰县| 霍林郭勒市| 奉化市| 察哈| 军事| 云和县| 拉萨市| 嘉禾县| 南平市| 三台县| 赣榆县| 景德镇市| 原平市| 德安县| 葵青区| 盈江县| 黄冈市|