How to save CHOICE MODE MULTIPLE
I want save checkbox. How to save CHOICE MODE MULTIPLE.
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_check_tab1,container,false);
mListView = (ListView) rootView.findViewById(R.id.check_ListView1);
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mListView.getCheckedItemPositions();
ArrayAdapter adapter = new ArrayAdapter<String>(getContext(),android.R.layout.simple_list_item_multiple_choice, air_list);
mListView.setItemChecked();
mListView.setAdapter(adapter);
return rootView;
}
class FM1Adapter extends BaseAdapter{
@Override
public int getCount() {
return air_list.length;
}
@Override
public Object getItem(int position) {
return air_list[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView view = new TextView(getContext());
view.setText(air_list[position]);
view.setTextSize(30.f);
view.setTextColor(Color.BLACK);
view.setGravity(1);
CheckBox box = new CheckBox(getContext());
box.isChecked();
return view;
}
链接地址: http://www.djcxy.com/p/81422.html
上一篇: hprof中没有“引用”的对象