learner
learner

Reputation: 11780

Diff between getExternalCacheDir vs getExternalFilesDir in android

I read the docs but I can't seem to figure out what the difference is. Is it something subtle that does not really matter? I want to create a cache of ten files. So when I went to use getExternalFilesDir, I noticed there is a getExternalCacheDir. So now I am confuse as to which one I should use (the name does not always tell the whole story). So can anyone put the difference in layman terms for me? thanks.

Upvotes: 6

Views: 6535

Answers (2)

Ramakishna Balla
Ramakishna Balla

Reputation: 1020

I'm a newbie to Android but would like to help you with the below link. The below article explores all possible ways / methods to use under different scenarios. It helped me in improving my understanding and hope the same with you and others as well

http://www.grokkingandroid.com/how-to-correctly-store-app-specific-files-in-android/

Upvotes: 2

Pontus Backlund
Pontus Backlund

Reputation: 1017

The ExternalFilesDir is not a cache, it will save your files, and they will remain there until the app is removed or the files manually whereas the cachedir will empty when needed

Upvotes: 5

Related Questions