Issue
I've got an app that accepts images via "Preview images" in Gmail on Android
I have the Uri :
content://gmail-ls/messages/my_gmail_id_@_gmail.com/65/attachments/0.1/SIMPLE/false
The Astro image viewer or Gallery can display the image very well
I can use the URI : content://media/external/images/media/79
but I dont know how to use this Uri to display image in my app.
Help me please
Solution
Sorry about that last answer. I am a bit embarrassed there. But this should be more of what you are looking for. This exact code may or may not run but conceptually this is way I found it should work. Let me know if you have any issues.
//Get your uri
Uri mAndroidUri = Uri.parse("content://gmail-ls/messages/my_gmail_id_@_gmail.com/65/attachments/0.1/SIMPLE/false");
ImageView iv = new ImageView(context);
try{
//converts android uri to java uri then from that to file
//after converting to file you should be able to manipulate it in anyway you like.
File mFile = new File(new URI(mAndroidUri.toString()));
Bitmap bmp = BitmapFactory.decodeStream(mFile);
if (null != bmp)
iv.setImageBitmap(bmp);
else
System.out.println("The Bitmap is NULL");
}catch(Exception e){}
}
Answered By - Terrance Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.