how to check the SharedPreferences string is empty or null *android

后端 未结 4 434
广开言路
广开言路 2020-12-10 05:11

I want to check a string in SharedPreferences used it to store username and password, so if username and password is not null or empty it will be directed to home, otherwise

4条回答
  •  不思量自难忘°
    2020-12-10 05:43

     if(appSettings.contains(Constants.WEATHER_SUBN_POSTION)) {
            savedSubPostion = appSettings.getInt(Constants.WEATHER_SUBN_POSTION, 0);
     }
    

    First check it contains the value.

提交回复
热议问题