//커스텀 다이얼로그를 위한 layout 입니다.
//제목과 제목옆에 체크박스가 있습니다.
//제목옆의 체크박스를 클릭하면 리스트에있는 모든것을 체크/해제 하려하는데
//이벤트를 못잡겠습니다. 어디서 처리해야 되는지요?


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/custom_dialog_title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/widget36"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5px"
android:layout_marginLeft="10px"
android:text="전화번호목록 입니다."
android:textSize="18sp"
android:typeface="sans"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
</TextView>
<CheckBox
android:id="@+id/chkListAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
>
</CheckBox> 
</RelativeLayout>


//전화번호 목록을 표시해주고 체크하는 다이얼로그 입니다.
//기본 다 체크되어 있는 상태고
//다이얼로그 제목옆에 있는 체크박스를 체크하면 모두체크/해제 하는 로직을 구현하려 합니다.
//다이얼로그 제목옆에 있는 체크박스의 이벤트를 어떻게 처리해야하는지 모르겠습니다.
//이벤트를 어떻게 잡아내야 되나요?

 


ArrayList<String> listInfo = makePhoneList();
String[] phoneList = new String[listInfo.size()];
boolean[] phoneChk = new boolean[listInfo.size()];
for(int i=0; i<phoneChk.length; i++)
{
phoneList[i] = listInfo.get(i);
phoneChk[i] = true;
}
Context mContext = getApplicationContext();
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.custom_dialog_title, (ViewGroup) findViewById(R.id.custom_dialog_title));

 // Dialog생성
 return new AlertDialog.Builder(inmac.this)
 
 .setCustomTitle(layout)  

 .setMultiChoiceItems(phoneList, phoneChk,  
         new DialogInterface.OnMultiChoiceClickListener() 
  {
             public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) 
            {
                 Log.d("Click", "체크박스 클릭");
             }             
         })
 
 //Dialog 내에서 OK버튼 틀릭
 .setPositiveButton("OK", new DialogInterface.OnClickListener() {
 public void onClick(DialogInterface dialog, int whichButton) {
 Log.d("Click", "OK");
)
 .setNegativeButton("취소", new DialogInterface.OnClickListener() {
 public void onClick(DialogInterface dialog, int whichButton) {

     /* User clicked No so do some stuff */
     }
 })
.create();



//감사합니다.