Issue
How do I convert in Bitmap a droawable resource that I have in form of String as it follows
android.resource://com.example.myapp/drawable/name_picture
Solution
Uri uriString = Uri.parse("android.resource://com.example.myapp/drawable/name_picture
");
String lastPathIcon = uriString.getLastPathSegment();
int drawableResource = getApplicationContext().getResources()
.getIdentifier("drawable/" + lastPathIcon, null, getApplicationContext().getPackageName());
largeIcon = BitmapFactory.decodeResource(getResources(), drawableResource);
Here the solution that worked for me.
Answered By - Alex
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.