String mail= "username@mail.com";
byte[] mailByte = mail.getBytes();
String mailBytetoString = mailByte.toString();
File f2 = new File(Environment.getExternalStorageDirectory().getPath()+ "/Android/Data/Settings/mail.txt");
if(!f2.exists())
f2.createNewFile();
BufferedWriter br = new BufferedWriter(new FileWriter(f2));
br.write(mailBytetoString);
br.close();
我将电子邮件地址的字节代码保存到txt文件,但我必须从txt文件中再次获取它(电子邮件地址)。可能吗?
答案 0 :(得分:0)
这将无法工作......你需要从数组中构造一个新的字符串......
String myEmail = new String(mailByte);