The issue is the way you are comparing ==. When comparing strings you need to use .equals(String) unless you want to know if the memory reference is identical in which case you would use the ==.