public String getRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index
= cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
Windows,Android,Linux,Apple Mac,Iphone,Ipad,Tips and Tricks,tutorial for Problem.Repair,Recovery,data,Troubleshooting,Computer Help,Software,Tweak Computers,Guide to Windows,linux and software Install guide.MotherBoard repair,Hardware.GSM,Phone,Wireless,WIFI,Msn,Ubuntu.Blogger tips....
Convert URI to real path format
In the exercises "Select Image using Android build-in Gallery" ad "Display Gallery selected image using BitmapFactory", the uri returned from build-in Gallery app is in the format of "content://media/external/images/...". To convert it to the real path format (eg. /mnt/sdcard/dropbox/Eric/....png), the following function can be used.