I'm trying to display an image of an activity but I have a couple to choose from. So I used an if statement to be able to tell which to display based on a string, my problem is the string was retrieved from the first activity.
this is the code for sending the Strings to the other activity(part of the code);
details.putExtra("des", des);
details.putExtra("name", name);
startActivity(details);
and these are the codes for retrieving and setting the images in Image View(part of the code);
username.setText(intent.getStringExtra("name"));
description.setText(intent.getStringExtra("des"));
if (intent.getStringExtra("name").equals("Sheilla")) {
image.setImageResource(R.drawable.sis);
}
The image doesn't get displayed if I do this but does get displayed if I try something like
if(true){
image.setImageResource(R.drawable.sis);
}
Can someone please tell me what I'm doing wrong and suggest a better way.