Reputation: 1063
How can we check the given file is present in Android Filesystem or not without using File inputstream.because I only want to check the existence of the file on the given path.
Upvotes: 1
Views: 128
Reputation: 3258
If you have created a file using openFileOutput
method then this works
File mFile = new File(getBaseContext().getFilesDir(),FileName);
if (mFile.exists() )
{
//File is Exits.
}
else
{
//File is not Exits.
}
hope this helps
Upvotes: 0
Reputation: 60681
File myFile = new File("/path/to/file");
if (myFile.isFile()) {
...
}
Upvotes: 1