Hello, I have a requirement to save a file in Android external SD card. I
have tried using this source code but it saves file in internal memory of
phone.
Here is my code.
try {
File newFolder = new File(Environment.getExternalStorageDirectory(),
"TestFolder");
if (!newFolder.exists()) {
newFolder.mkdir();
}
File file = new File(newFolder, "MyTest" + ".txt");
if (!file.exists()) {
file.createNewFile();
}
Toast.makeText(MainActivity.this, "Created Successfully!",
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/713aa0de-ad4d-46a1-99d6-d985f82eec4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.