summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Cook <nickcook@google.com>2019-08-19 18:04:42 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-08-19 18:04:42 -0700
commitcc4b685d3efcb73eba2977900af2734c2bfc6daf (patch)
tree64228ce1e504bcdf09b0b94dbad413640fe1ec57
parent480bb75f45dcad046b87dc4e5591821cff5ef27e (diff)
parentf767eb4aa92dd6b4a864ed4e46dba63f75e41338 (diff)
downloadandroid_development-cc4b685d3efcb73eba2977900af2734c2bfc6daf.tar.gz
android_development-cc4b685d3efcb73eba2977900af2734c2bfc6daf.tar.bz2
android_development-cc4b685d3efcb73eba2977900af2734c2bfc6daf.zip
docs: Fix outdated sample code in Context#getExternalFilesDir. Test: make ds-docs
am: f767eb4aa9 Change-Id: I7e225bc7feb33b18fedf25215dde3c3207c351d6
-rw-r--r--samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java9
1 files changed, 2 insertions, 7 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java b/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java
index 534a1c822..b76d1b42a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java
+++ b/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java
@@ -339,19 +339,14 @@ public class ExternalStorage extends Activity {
// Get path for the file on external storage. If external
// storage is not currently mounted this will fail.
File file = new File(getExternalFilesDir(null), "DemoFile.jpg");
- if (file != null) {
- file.delete();
- }
+ file.delete();
}
boolean hasExternalStoragePrivateFile() {
// Get path for the file on external storage. If external
// storage is not currently mounted this will fail.
File file = new File(getExternalFilesDir(null), "DemoFile.jpg");
- if (file != null) {
- return file.exists();
- }
- return false;
+ return file.exists();
}
// END_INCLUDE(private_file)