How to match correct answers in a randomly generated array in Android?

By Mac

So I’m creating a riddle app that when you swipe up on the screen it will come up with a riddle that is randomly generated using an array. Now I have no idea which riddle will pop up because of course, it’s random but I want the user to be able to click and hold on the randomly generated riddle and the answer will then pop up replacing the riddle. So far I have the array done to where it will randomly generate a riddle but I’m having a problem getting the answer to match up with riddles because of course they are random too. How would I go about matching correct answers to a random array on a long press of the text view?

I did see two other questions (one,two) and similar to this one but it did not answer the question that I have and it really wasn’t specific.

final TextView answerTxt = (TextView)
    final String[] riddles = {
            "No man is an island.",
            "Keep your friends close and your enemies closer.",
            "Never look a gift horse in the mouth.",
            "A watched pot never boils."
    //random generator for user fortune
    final int random = (int) (Math.random() * riddles.length);

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273