Issue
I would like to set a background image but not from drawable folder, the image is from gallery which is internal storage.
Is it possible to do that ?
Solution
call this from Activity
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
You may open Gallery intent from Activity and also handle OnActicityResult method ..... Try This link for solution
So, now for setBackground you can convert bitmap to drawable using below code..
Drawable d = new BitmapDrawable(getResources(),bitmap);
view.setBackground(d);
I hope this may help you...
Answered By - Chirag Ghori
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.