android 文件流

无线大脑袋 2018-10-03 01:22:21
try {
out = new FileOutputStream(file);
out.write("123".getBytes());
out.close();

in = new FileInputStream(file);
in.read(buffer);
String string = new String(buffer);
if(string.equals("123"))
textView.setText(string);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



textView.setText(string) 不执行,这是为什么
...全文
263 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
guwei4037 2018-10-04
  • 打赏
  • 举报
回复
if(string.equals("123"))

可能条件不匹配,所有没有进入textView.setText(string);

设置断点,调试看一下。

另外一个建议,不要把变量名定义为string,跟关键字太像了。
YXTS122 2018-10-03
  • 打赏
  • 举报
回复
把代码发完整或直接把项目发我邮箱144408987l@qqcom:

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧