You need to try with contains(String Key)
Try this spv.contains("uname") instead of (spv !=null) or spv.equals("") I also Faced this issue Better To use Hashmap… but this works for your Case..
4
solved Condition is not working in sharedpreferences android