Reputation: 1951
I want to use the sdcard as a storage support of my application's data, the problem I encountered the path varies depending on the manufacturer, I do not have the same configuration for all tablets. I used the code below.
File root = Environment.getExternalStorageDirectory();
String Path = root.getAbsolutePath().toString();
File mFile = new File(Path+ "/fileName");
if(mFile.exists()){
mFile.delete();
}
With some tablets the job is done and the file is deleted with other no. So can you tell me how to get the external storage for all tablets.
Upvotes: 0
Views: 157
Reputation: 157447
File
has a constructor that takes two parameters. A file and a String.
File root = Environment.getExternalStorageDirectory();
File mFile = new File(root, "fileName");
if(mFile.exists()){
mFile.delete();
}
Upvotes: 1