private void readFromFile() {        try {                        FileInputStream file = openFileInput("test.txt");            byte[] buffer = new byte[file.available()];            file.read(buffer);            file.close();            String name=new String(buffer);             TextView text = (TextView) findViewById(R.id.test);            text.setText(name);        } catch (IOException e) {            e.printStackTrace();        }            }    private void writeToFile() {        try {            String str = "测试中文";            FileOutputStream file = openFileOutput("test.txt", MODE_APPEND);            file.write(str.getBytes());            file.close();        } catch (IOException e) {            e.printStackTrace();        }    }

更多相关文章

  1. Android自动测试之MonkeyRunner之monkeyrunner
  2. Android(安卓)CTS 兼容性测试的Fail的一些修改
  3. Android(安卓)动态布局 (代码布局)
  4. Android(安卓)CTS Test
  5. Android(安卓)CTS Verifier Sensor Test Cases (1)
  6. android 性能优化
  7. android折叠展开自定义列表项测试
  8. Android限制EditText只能输入中文、英文、数字
  9. android中ActionBar +Fragment

随机推荐

  1. c++是什么意思
  2. c语言中的“?:”是什么运算符
  3. c语言求阶乘
  4. c语言实现输入圆的半径计算圆的面积
  5. 字符串处理函数是什么
  6. c语言计算1~n的阶乘之和
  7. c语言如何求三角形的面积
  8. c语言中x++和++x有什么区别
  9. c语言中while与do while循环的主要区别是
  10. c语言实现删除字符串中的数字字符