docs: Fix outdated sample code in Context#getExternalFilesDir. Test: make ds-docs

am: f767eb4aa9

Change-Id: I0a5d7d6f6fa9b28f650891d4a70b7efbcc053f45
This commit is contained in:
Nick Cook
2019-08-19 18:04:42 -07:00
committed by android-build-merger

View File

@@ -339,20 +339,15 @@ 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)
Item createStorageControls(CharSequence label, File path, Item createStorageControls(CharSequence label, File path,