91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

內存卡的數據保存與讀取

發布時間: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

察雅县| 宁阳县| 平凉市| 台湾省| 武威市| 灵宝市| 宝鸡市| 青岛市| 武鸣县| 天柱县| 东阳市| 东丰县| 深州市| 阿合奇县| 项城市| 克东县| 集安市| 沁水县| 博湖县| 巴青县| 龙江县| 泽普县| 康平县| 马关县| 梁山县| 洪江市| 石柱| 卢氏县| 娱乐| 芒康县| 鹿邑县| 忻城县| 山阳县| 平定县| 包头市| 阳山县| 邛崃市| 慈利县| 揭西县| 昌邑市| 万源市|