Android sharedpreferences getstring

时间:2017-04-06 15:05:36

标签: android sharedpreferences

代码:

editor.putString("linkid",a);                                                            
editor.apply();

final Intent intent1 = new Intent(getActivity(), thirdreq.class);
startActivity(intent1);


for(int d=0;d<Integer.valueOf(dcountpeople[myid]);d++){
    did2[d] = pref.getString("did2" + "[" + d + "]",null);
    dformname2[d] = pref.getString("dformname2" + "[" + d + "]", null);
    dregdate2[d] = pref.getString("dregdate2" + "[" + d + "]", null);
    Log.i("Res:", did2[d] + ":" + dformname2[d] + ":" + dregdate2[d]);
    txtshowpeoplearray[d].setVisibility(View.VISIBLE);
    txtpeopleshowdatearray[d].setVisibility(View.VISIBLE);
    btnpeopleviewarray[d].setVisibility(View.VISIBLE);
    btnpeopledeletearray[d].setVisibility(View.VISIBLE);
    txtshowpeoplearray[d].setText(dformname2[d]);
    txtpeopleshowdatearray[d].setText(dregdate2[d]);
}

将这些代码转换为Button click监听器和 pref.getstrings在运行2次时正常工作(点击按钮2次)!

0 个答案:

没有答案