Created
August 27, 2014 20:08
-
-
Save mistrydarshan99/117265fbf5a0213b1170 to your computer and use it in GitHub Desktop.
Get image path taken from camera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Uri getImageUri(Context inContext, Bitmap inImage) { | |
ByteArrayOutputStream bytes = new ByteArrayOutputStream(); | |
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); | |
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); | |
return Uri.parse(path); | |
} | |
private String getPath(Uri uri) { | |
String[] projection = { MediaStore.Images.Media.DATA }; | |
Cursor cursor = getContentResolver().query(uri, projection, null, null,null); | |
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); | |
cursor.moveToFirst(); | |
return cursor.getString(column_index); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment