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 final String CACHEDIR = Environment.getExternalStorageDirectory() + "/myName/images"; public static Bitmap getImg(String url) { if (!isMounted()) return null; File imgFile = new File(CACHEDIR, getName(url)); if (imgFile.exists()) { return BitmapFactory.decodeFile(imgFile.getAbsolutePath()); } return null; } public static boolean isMounted() { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); } public static String getName(String url) { String a = url.substring(0, url.lastIndexOf("/")); return a.substring(a.lastIndexOf("/") + 1) + ".jpg"; } public String getName(String url, int end) { return url.substring(url.lastIndexOf("/") + 1, end); } }