Browse files

Merge branch 'dev' of github.com:chrisbanes/Android-BitmapCache into dev

  • Loading branch information...
2 parents 0628bbf + 1fc2ede commit 39b622600059eff909896e79f55ded8ddf402628 @chrisbanes committed Feb 23, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 sample/src/uk/co/senab/bitmapcache/samples/SampleApplication.java
View
12 sample/src/uk/co/senab/bitmapcache/samples/SampleApplication.java
@@ -31,8 +31,16 @@
public void onCreate() {
super.onCreate();
- File cacheLocation = new File(
- Environment.getExternalStorageDirectory() + "/Android-BitmapCache");
+ File cacheLocation;
+
+ // If we have external storage use it for the disk cache. Otherwise we use
+ // the cache dir
+ if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
+ cacheLocation = new File(
+ Environment.getExternalStorageDirectory() + "/Android-BitmapCache");
+ } else {
+ cacheLocation = new File(getFilesDir() + "/Android-BitmapCache");
+ }
cacheLocation.mkdirs();
BitmapLruCache.Builder builder = new BitmapLruCache.Builder();

0 comments on commit 39b6226

Please sign in to comment.