汇总检索到的共享首选项值

时间:2019-03-03 03:40:52

标签: sharedpreferences

//请用户使用以下命令保存一些整数值 //共享的首选项如何显示新旧总和 //用户的价值?

 sharedPreferences = this.getActivity().getSharedPreferences("Home report", MODE_PRIVATE);
        String Hours = sharedPreferences.getString("Hours",DEFAULT);
        String Minutes = sharedPreferences.getString("Minutes",DEFAULT);
        String Placements = sharedPreferences.getString("Placements",DEFAULT);
        String Videos = sharedPreferences.getString("Videos",DEFAULT);
        String Visits = sharedPreferences.getString("Visits",DEFAULT);
        String Studies = sharedPreferences.getString("Studies",DEFAULT);
        if (Hours.equals(DEFAULT) || Minutes.equals(DEFAULT) || Placements.equals(DEFAULT) || Videos.equals(DEFAULT) ||
                Visits.equals(DEFAULT) || Studies.equals(DEFAULT)){

        }else {
            hoursValue.setText(Hours);
            minutesvalue.setText(Minutes);
            placementsValue.setText(Placements);
            videosValue.setText(Videos);
            visitsValue.setText(Visits);
            studiesValue.setText(Studies);
        }

0 个答案:

没有答案