I am writing a service application in Android. In this application, I am receiving commands from Main activity using onStartCommand event. The IF block is checking a variable. As you can see in the picture(Debug mode), the value is “start” but the IF statement doesn’t work and will redirect to Else. why?

try with
.equalswill help you…String is not Primary Data type in javaAlways use
.equals() when you have ObjectandString is Object==is only forprimitive data typeand==in object compare your String Refrences…not value…