docs: Fix outdated sample code in Context#getExternalFilesDir.

Test: make ds-docs

Bug: 129290716
Change-Id: I0b1c1d9222c96c6bb2777f58d273546c81d77eb2
This commit is contained in:
Nick Cook
2019-07-18 22:27:08 +00:00
parent 36de302069
commit f767eb4aa9

View File

@@ -339,19 +339,14 @@ public class ExternalStorage extends Activity {
// Get path for the file on external storage. If external // Get path for the file on external storage. If external
// storage is not currently mounted this will fail. // storage is not currently mounted this will fail.
File file = new File(getExternalFilesDir(null), "DemoFile.jpg"); File file = new File(getExternalFilesDir(null), "DemoFile.jpg");
if (file != null) { file.delete();
file.delete();
}
} }
boolean hasExternalStoragePrivateFile() { boolean hasExternalStoragePrivateFile() {
// Get path for the file on external storage. If external // Get path for the file on external storage. If external
// storage is not currently mounted this will fail. // storage is not currently mounted this will fail.
File file = new File(getExternalFilesDir(null), "DemoFile.jpg"); File file = new File(getExternalFilesDir(null), "DemoFile.jpg");
if (file != null) { return file.exists();
return file.exists();
}
return false;
} }
// END_INCLUDE(private_file) // END_INCLUDE(private_file)