Android examples for android.graphics:Image Load Save
get Image Uri From Media Provider
import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore.Images; public class Main { public static final Uri getImageUriFromMediaProvider(Context ctxt, String imageFile) { String selection = Images.ImageColumns.DATA + "=?"; String[] selectArgs = { imageFile }; String[] projection = { Images.ImageColumns._ID }; Cursor c = null;/* w w w . ja v a 2 s .co m*/ try { c = ctxt.getContentResolver().query(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, selection, selectArgs, null); if (c.getCount() > 0) { c.moveToFirst(); String id = c.getString(c.getColumnIndex(Images.ImageColumns._ID)); return Uri.withAppendedPath(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id); } return null; } finally { if (c != null) { c.close(); } } } }