How to get the src from an ImageButton in Android?

I'm building the Activity to take information on the users pet and make a sqlite database entry with it. I want to be able to take a picture and store the src as one of the rows in the entry.

I currently have an ImageButton displaying a default picture from drawable, but how do I extract the src from the ImageButton?

I figure if I can do that then it'll be easy to make the button clickable so the user can set their own (then when they hit the save button, it'll grab the src of the new pic instead, otherwise if they don't click it the default pic will get saved)

Upvotes: 1

Views: 2079

Answers (1)

Rajan Bhavsar
Rajan Bhavsar

Reputation: 1857

Please Check the Below answer may be helps you.

Bitmap bitmap = ((BitmapDrawable)imagebutton.getDrawable()).getBitmap();

Upvotes: 2

Related Questions