I am having this strange behavior when performing a method which the if statement where both values are true but it fails to go over the if statement.
Here is the code and how it looks like. On top right where it is circled red is the value of className.
If anyone has an idea why this is occurring or might have a better way of doing it please respond or guide me to a better coding logic to that I am already using.
On debug className = “rwb”
public void ClassReturn(){
String tempName = getIntent().getExtras().getString("CLASS_NAME");
if(tempName == null){
Log.i("Intent Delivery", "Intent deliver has failed.");
}else{
String className = tempName; // This is return back to the correct class your in
if(className == "rwb"){
Intent intent = new Intent(BasicOption.this, ReadWholeBook.class);
startActivity(intent);
}
}
}

Use .equals() to check if two objects are logically equal, use == the check if they are the same object.
Strings in java can be more complicated because of interning but basically you want to use the .equals() or .equalsIgnoreCase() to check the contents of the two strings are the same.