I'm trying to make a quiz app. I want to get the name of the image currently displayed in the imageview.
for example, if cat.jpeg is displayed in imageview i want to retrive "cat" as a variable.
I'm trying to make a quiz app. I want to get the name of the image currently displayed in the imageview.
for example, if cat.jpeg is displayed in imageview i want to retrive "cat" as a variable.
There's an accessibility feature called "Content Description". It's a text description for people that, for some reason, are not able to see the image. You can have the description of the image on the XML file and get it in you java/kotlin code.
BUT
If the image and the text (description) are connected, they should belong to a "bigger" object. Since you have a Quizz app, you can have a "Question" object with properties like "questionText", "questionImgUrl", "questionImgText", "questionAlternativeA", ....
So, when you open a activity/fragment with a question, you'll be able to load the image with Question.questionImgUrl (for exemple, the cat photo) and load the info you want by calling Question.questionImgText (the string "cat").