android - Shared Preference String Variable does not work in if statement -
i can not use string value shared preference in if statement.
here's brief description:
if(jm == "mute"){ // } this statement works when
string jm = "mute"; but doesn't work when
prefs = getsharedpreferences(pref_name, 0); string jm = prefs.getstring("key", ""); //which returns mute
use .equals in if statement work change
if(jm == "mute"){ to
if(jm.equals("mute")){ for more info see how compare strings in java?
Comments
Post a Comment