Tapan Desai
Tapan Desai

Reputation: 848

facing a strange kind of situation while using if else

I am creating a application for android, in which i am retrieving the name of sms gateway using the spinner. I have used api for sending sms, but my primary api is not supporting one website which other api support so i implemented if else validation to use the second api in case the user selects the website not supported by primary api. I am attaching the screenshot of the problem. Have a look at the code in red box and the log cat as well. The problem as you can see in the image is that even when the IF CONDITION is TRUE it is hitting ELSE part. What is causing such problem?

enter image description here

Upvotes: 0

Views: 164

Answers (1)

Samir Mangroliya
Samir Mangroliya

Reputation: 40416

Use .equals() to compare Strings in java.

== compares String Refrences(Memory Location)

.equals() compares Strings values.

Solution::

if(gateway_name.equals("ultoo")){

}

Upvotes: 7

Related Questions