Android 기기 용 프로그래밍을 처음 사용합니다. simple_list_item_multiple_choice 및 배열 어댑터를 사용하여 생성 된 내 listview에서 확인란을 저장하는 방법을 알아 내려고 노력 중입니다. 나는 체크 박스의 상태를 저장하여 사용자가 다른 체크리스트로 가기 위해 뒤로 버튼을 치면 그들이이 체크리스트와 픽업으로 되돌아 갈 수 있도록하고 싶다.listview simple_list_item_multiple_choice 배열 어댑터를 사용하여 확인란 상태 저장
제발, 제발 도와주세요 !! 코드 및/또는 설명이 이상적입니다.
코드 :
public class BeachBabyStuff extends Activity {
String[] beachstuffbaby = new String[]{
"Beach Blanket or Mat",
"Beach Towels",
"Beach Umbrella",
"Beach Chair",
"Books/Magazines",
"Radio",
"Pen/Paper",
"Tablet"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
// Getting the reference to the listview object of the layout
ListView listView = (ListView) findViewById(R.id.listview);
// The checkbox for the each item is specified by the layout android.R.layout.simple_list_item_multiple_choice
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, beachstuffbaby);
// Setting adapter to the listview
listView.setAdapter(adapter);
//Manage the onItemClick method
listView.setOnItemClickListener(new OnItemClickListener() {
private View view;
public void onItemClick(AdapterView<?> ListView, View view, int position, long id) {
CheckedTextView textView = (CheckedTextView)view;
textView.setChecked(!textView.isChecked());
this.view = view;
}
});
현재 행동이란 무엇입니까? AFAIK 다른 주에서 돌아온 후에 주정부는 변경해서는 안됩니다. – Ronnie