I am creating an Android program and when a button is clicked, it checks if the 2 images are the same (ImageView and EmojiconTextView). EmojiconTextView is from a library that I am using in my app.
public void clickedCheck(View view) {
String input = emojiconTextView.getTag().toString();
String input2 = myRandomImage.getTag().toString();
if (input.equals(input2)) {
checkingText.setText("Well Done!");
} else {
checkingText.setText("Unlucky!");
}
}
However, when I click the button, the program displays "Unlucky" even if the images are equal. So it totally disregards my 'if-statement'.
This is my ImageView attribute:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/myRandomImage"
android:tag="myTag2"
android:layout_above="@+id/emojicon_text_view"
android:layout_centerHorizontal="true"/>
And this is is from my EmojiconTextView:
<hani.momanii.supernova_emoji_library.Helper.EmojiconTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/emojicon_text_view"
android:textColor="@android:color/black"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:text="Emojicon Text View"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:tag="myTag"
android:layout_marginTop="26dp"/>
If you need further help with understanding the question, please let me know.