I’m trying to create an Android app that adds a random quote to images.
The general process is this:
- Start from a custom given image that shows when starting the app.
- From this image all the user can do is tap on it and generate a new random “quote” that get overlaid on the image.
- The user can save the newly created image with the quote he chose and set it as wallpaper.
I have got to the point where I can display the image in an ImageView.
My list of quotes is stored in my strings.xml file.
Ok! Francesco my friend, I’ve an idea although not a working code (‘cuz I’m not really good at it). So, here it is:
Implement an
onClickListener()on yourImageViewlike below:When it comes to reading user input/generating random quotes, you can do this:
You said you already have the quotes saved in the
strings.xmlfile. Using the ids of those strings, I think you can implement aswitchcase scenario where it usesjava imports–java.util.Scannerandjava.util.Random. Ultimately, using these in yourImageViewonClickListenercould/should result in the desired output.I know my answer is too vague, but I’ve a faint hope that it has given you a minute lead as to what you can implement. I seriously hope there are better answers than this. If not, then I hope this helps you some, and I also hope that I’m not leading you in the wrong direction since this is just a mere speculation. Sorry, but this is all I’ve got.