I'm making an android app that displays a game character based on the user's input/choices in the previous activity. I've used Extras to do this:
UserName = getIntent().getExtras().getSerializable("Name").toString();
UserCharacter = (String) getIntent().getExtras().getSerializable("Char").toString();
UserItem = getIntent().getExtras().getSerializable("Itemz").toString();
UserRating = getIntent().getExtras().getSerializable("Stars").toString();
I know this works because,
summary = (TextView) findViewById (R.id.Summary);
summary.setText("Name: " + UserName + "\nCharacter: " + UserCharacter + "\nItems: " + UserItem + "\nRating: " + UserRating);
displays the user's selections completely fine. However, when I pass in these data into a if/else-if statement, the code simply ignores the if statements. Here's an example:
if (UserItem == "Wing + Helmet + Scarf")
image.setImageResource(R.drawable.tal);
Instead of displaying the new ImageView, the app would simply display the default image I had to use to create the ImageView in the .xml. I've tried various ways to work around this to no success. I know the ImageResource part works because if it is taken out of the if statements, then it changes the ImageView perfectly fine. Any suggestions would be greatly appreciated. Thanks in advance!