嗨,我正在尝试从列表视图中保存用户首选项,我希望它存储选择的内容,然后当应用程序再次加载时检查首选项选择的方法,如果它 = 团队然后做某事,但目前它没有在偏好中加载任何关于我做错了什么的想法。当我注销选择的方法时,它显示为空
这是我的代码
preferences.edit().putString("ChosenMethod", "Team").commit();
    preferences.edit().putString("ChosenTeam", ChosenTeam).commit();
    preferences.edit().putString("ChosenTeamId", ChosenTeam).commit();
    preferences.edit().putString("ChosenLeagueId", ChosenTeam).commit();
    preferences.edit().putString("ChosenDivisionID", ChosenTeam).commit();
然后在 introActivity 我把这个
protected void checkPreferences(){
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
     Log.v("myapp", "prefs = " + preferences);
     String ChosenMethod = preferences.getString("ChosenTeam", chosenMethod);
     Log.v("myapp", "ChosenMethod = " + ChosenMethod);
     if (ChosenMethod != null){
         Intent intent = new Intent(TheEvoStikLeagueActivity.this,Activity.class);
     }
}
            @Override
            public void onCreate(Bundle icicle) {
                    super.onCreate(icicle);
                    setContentView(R.layout.main);
                    checkPreferences();