用android在外部存储中编写一个文件
btnWriteSDFile = (Button) findViewById(R.id.btnWriteSDFile);btnWriteSDFile.setOnClickListener(new OnClickListener() { //private Throwable e; @Override public void onClick(View v) { // write on SD card file data from the text box try { File myFile = new File("/sdcard/mysdfile.txt"); myFile.createNewFile(); FileOutputStream fOut = new FileOutputStream(myFile); OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut); myOutWriter.append(txtData.getText()); myOutWriter.close(); fOut.close(); } catch (Exception e) { Log.e("ERRR", "Could not create file",e); } }// onClick}); // btnWriteSDFile
慕森王
相关分类