Back to project page HomeMovies.
The source code is released under:
MIT License
If you think the Android project HomeMovies listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package il.co.All4Students.homemovies.util.imageWeb; /* w w w . jav a2 s .c o m*/ import java.io.File; import android.content.Context; public class FileCache { // Attributes private File cacheDirectory; // Constractor public FileCache(Context context) { if (android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED)) { cacheDirectory = new File( android.os.Environment.getExternalStorageDirectory(), "Images_cache"); } else { cacheDirectory = context.getCacheDir(); } if (!cacheDirectory.exists()) { cacheDirectory.mkdirs(); } } // Additional Methods public File getFile(String url) { String filename = String.valueOf(url.hashCode()); File f = new File(cacheDirectory, filename); return f; } public void clear() { File[] files = cacheDirectory.listFiles(); if (files == null) { return; } for (File f : files) { f.delete(); } } }