I am having a simple problem and have searched around, but no luck so far. (Soundboard type application - only one button so far)
Currently, I click the "soundboard" button on my home screen and it leads to my one button trial soundboard- I have an "addimage" button on top of the page. Underneath the button is a blank image button (to be filled). upon clicking "addimage", I am taken to the gallery where I select an image. After selection, the image is set as the background in the imagebutton (source becomes background). After much trial and error, I have finally knocked down the scaling issue (if selected image was big, it blew up inside the button).
Now my issue is getting the selected image to "stick" to the button. If I click the back button to go back to the home on the bottom bar or click the back button on the action bar (from the soundboard page) --- and the go back to the soundboard after--- the previously selected image which was set to the imagebutton is not there anymore (seems image button is reset or reinitialized). Is there a way I can get that selected image to stick and not erase/clear if I go to a different page or exit? Not sure how this would be handled
Included is a snippet of the code for setting the selected image from gallery to the imagebutton and perform some sort of scaling. I couldn't post a picture...but I hope you can imagine...very simple.
Thank You!
PS: The eventual goal is to then use soundpool and a small audio clip in raw folder and link that to the imagebutton above - audio output.
ImageButton imagebutton = (ImageButton) findViewById(R.id.imBut);
Bitmap bitmaporg = BitmapFactory.decodeFile(picturePath);
bitmaporg = Bitmap.createScaledBitmap(bitmaporg,350,350,true);
imagebutton.setImageBitmap(bitmaporg);