-4

I am trying to create a word quiz game. I have a list of random words which are going to appear, and the player must arrange them correctly. Now I want to add hints. For example, if word is "School" appears, I want the hint to be "photo of school"

These are the words in the code's layout

<string-array name="words">
    <item>SCHOOL</item>
    <item>ABETS.BEATS.BEAST</item>
    <item>ANGEL.ANGLE.GLEAN</item>
    <item>COATS.COAST.TACOS</item>

</string-array>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

-1

In android studios go to res/drawable and add the photos you want to use there. Here's how to do that : How to add an image to the "drawable" folder in Android Studio?

Then you initialize the photos with :

private ImageView schoolPhoto;
schoolPhoto = (ImageView) findViewById(R.id.imageViewId);
schoolPhoto.setImageResource(R.drawable.imageFileId);

Then you can create a method with toast which is often used for hints:

public static displayHint( ImageView imageHint) {
Toast toast = new Toast(this);
    toast.setView(imageHint);
    toast.show();}

And run that method as displayHint(schoolPhoto) when you show the string.

Faris Kapo
  • 346
  • 9
  • 30
  • I downvoted because, first you did not read the question, he did not ask anything about images. He has a Array that is populated in a list. Secondly `PopupMenu` would be a much better approach then showing a simple `Toast`. – HB. Nov 25 '17 at 18:53
  • so what i do plz ?? – Bassem Sameh Nov 25 '17 at 19:25
  • @H.Brooks I understood the >' I want the hint to be "photo of school" ' as i want it to be an image, it never came cross my mind that it might be a text that says "photo of school". Also I believe you're setting a bad precedence here, because I wanted to help the guy out and all I could do for his 0 answer question was try to edit it into better shape and then offer a solution to the question as best as I can. Or I might be the one setting a bad precedence by answering his poorly written question, but he also might just have bad english and new to the community. – Faris Kapo Nov 25 '17 at 22:44