Reputation: 227
i just now create an application in which i can read files from sdcard,but it is opening only one of the file from the sdcard,for rest it is providing a warning
03-26 14:53:33.746: W/System.err(28907): java.
io.FileNotFoundException: /sdcard/miniclipId: open failed: ENOENT (No such file or directory)
String filename = editTextFileName.getText().toString();
StringBuffer stringBuffer = new StringBuffer();
String aDataRow = "";
String aBuffer = "";
try {
File myFile = new File("/sdcard/" + filename);
FileInputStream fIn = new FileInputStream(myFile);
BufferedReader myReader = new BufferedReader(
new InputStreamReader(fIn));
while ((aDataRow = myReader.readLine()) != null) {
aBuffer += aDataRow + "\n";
}
myReader.close();
} catch (IOException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext
(), aBuffer, Toast.LENGTH_LONG).show();
txt.setText(aBuffer.toString());
}
Upvotes: 0
Views: 2277
Reputation: 703
/sdcard/
is not mean real sdCard.
Try this.
File myFile = new File(Environment.getExternalStorageDirectory() + filename);
Upvotes: 1