안드로이드 개발 질문/답변
(글 수 45,052)
simple_list_item_multiple_choice로 리스트를 하나 만들었는데요
리스트의 내용이 체크가 되어있는지 안되어있는지 알아내려고학는데요
isChecked 메소드가 안나오네요..
isEnable()이랑 isSelected()도 안되고..
빨간 is 부분에 뭘 해야할지 모르겠어요
답변 부탁드려요 ㅠㅠ
private static final String[] myList = new String[] { "Macro Example1",
"Macro Example2", "Macro Example3", "Macro Example4",
"Macro Example5" };
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, myList));
ListView listView = getListView();
listView.setItemsCanFocus(false);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
public void onListItemClick(ListView l, View v, int position, long id) {
String str = "";
if(l.getChildAt(position).is()){
str = myList[position] + " is activated";
Toast toast = Toast.makeText(SmartMacroUITest2.this, str, Toast.LENGTH_SHORT);
toast.show();
}else{
str = myList[position] + " is deactivated";
Toast toast = Toast.makeText(SmartMacroUITest2.this, str, Toast.LENGTH_SHORT);
toast.show();
}
}




잘은 모르지만...ListView 가 아니라 View 에서 child Item 을 받아 isChecked 로 확인하면 되지 않을까 싶은데요