My if statement doesn't work
问题 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? 回答1: try with .equals will help you... String is not Primary Data type in java Always use .equals() when you have Object and String is Object == is only for primitive data type and == in