Skip to content

Instantly share code, notes, and snippets.

@IlyaEremin
Created August 28, 2015 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaEremin/6c8156e5574b18b3b26c to your computer and use it in GitHub Desktop.
Save IlyaEremin/6c8156e5574b18b3b26c to your computer and use it in GitHub Desktop.
dagger cache
@Provides @CacheDir File provideCacheDir(Context context) {
File f = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
? context.getExternalCacheDir()
: context.getCacheDir();
if (f != null) {
f.mkdirs();
}
return f;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment