KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to create a file in external storage sdCard and write to it.I have searched through internet and try but not getting the result,I have added permission in Android Manifest file as well,I am doing this on Emulator,I am trying the following code and getting a ERRR", "Could not create file". 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
Tags (comma-separated)
Save Edits
Cancel