Android examples for Graphics:Image Download
Get image Path from URI
//package com.java2s; import android.net.Uri; import android.content.Context; import android.provider.MediaStore; import android.database.Cursor; public class Main { public static String imagePath(Context context, Uri photoUri) { Cursor photoCursor = null; try {//from ww w . ja v a 2 s . c o m // Attempt to fetch asset filename for image String[] projection = { MediaStore.Images.Media.DATA }; photoCursor = context.getContentResolver().query(photoUri, projection, null, null, null); if (photoCursor != null && photoCursor.getCount() == 1) { photoCursor.moveToFirst(); return photoCursor.getString(photoCursor .getColumnIndex(MediaStore.Images.Media.DATA)); } } finally { if (photoCursor != null) { photoCursor.close(); } } return ""; } }