Java tutorial
//package com.java2s; import java.io.File; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; public class Main { public static Bitmap loadFromCacheFile() { return loadFromFile(getCacheFilename()); } public static Bitmap loadFromFile(String filename) { try { File f = new File(filename); if (!f.exists()) { return null; } Bitmap tmp = BitmapFactory.decodeFile(filename); return tmp; } catch (Exception e) { e.printStackTrace(); return null; } } public static String getCacheFilename() { File f = getSavePath(); return f.getAbsolutePath() + "/cache.png"; } public static File getSavePath() { File path; if (hasSDCard()) { // SD card path = new File(getSDCardPath() + "/flipbook/"); path.mkdir(); } else { path = Environment.getDataDirectory(); } return path; } public static boolean hasSDCard() { // SD???????? String status = Environment.getExternalStorageState(); return status.equals(Environment.MEDIA_MOUNTED); } public static String getSDCardPath() { File path = Environment.getExternalStorageDirectory(); return path.getAbsolutePath(); } }