PDA

View Full Version : کدنویسی SharedPreferences



فاطمه وطن دوست
چهارشنبه 28 مرداد 1394, 19:36 عصر
سلام

این یه تیکه کد و دارم میخوام از شی SharedPreferences استفاده کنم.



public View getView(LayoutInflater inflater, View convertView) {
View view;

if(convertView == null) {
view = (View) inflater.inflate(R.layout.flag_image_row,null);
} else {
view = convertView;
}

TextView countryName = (TextView) view.findViewById(R.id.tv_row_text);
ImageView statusView = (ImageView) view.findViewById(R.id.iv_row_status);
countryName.setText(country.getDrawableId());

if(status == null) {
statusView.setImageDrawable(null);
} else {
if(status) {
statusView.setImageResource(R.drawable.thumps_up_b utton);
} else {
statusView.setImageResource(R.drawable.thumps_down _button);
}
}

return view;
}



از این تکه کد استفاده کردم ولی خطا میده. یش راهنمائی کنید؟


final SharedPreferences shp = context.getSharedPreferences("text", context.MODE_MULTI_PROCESS);
fontSize = shp.getInt("fontSize",fontSize);