2012-07-03 4 views
0

학생 이름이 DB에서 가져 와서 경고 상자에 표시하는 것과 같은 요구 사항이 있습니다. 그 경고의 각 학생 이름에 대한 확인란이 표시되어야합니다. 사용자가 경고 상자에서 학생 이름을 선택할 수 있습니다. 학생 이름을 입력했습니다. 각 학생의 확인란을 표시 할 수있는 사람이 있습니까?알림에 동적 체크 박스를 추가하십시오.

public void Show_friends() 
{ 
     AlertDialog.Builder builder1 = new AlertDialog.Builder(this); 
    try 
    { 
     builder1.setItems(paymentby,new DialogInterface.OnClickListener() 
     { 
     public void onClick(DialogInterface dialog, int item) 
     { 

     } 
     } 
     ); 
     AlertDialog alert = builder1.create(); 
     alert.show(); 


    } 
    catch (Exception e) { 
     System.out.println("Gesture exception caught"); 
    } 
    System.out.println("================vij=========================inside if"); 

} 
} 

이것은 내 코드입니다.

+0

이 .. 당신을 도움이 링크를 참조 http://stackoverflow.com/a/10933605/1168654 http://stackoverflow.com/a/10652886/1168654 –

답변

0

이 작업을 수행하려면 사용자 지정 대화 상자가 필요합니다. 어떻게 할 수 있는지 알고 싶으시면 this을 참조하십시오.

0
AlertDialog.Builder builder = new AlertDialog.Builder(this); 
    builder.setTitle("Select the Friends"); 

    builder.setMultiChoiceItems(paymentby,null, new OnMultiChoiceClickListener() 
    { 
     public void onClick (DialogInterface dialog, int which, boolean isChecked) 
     { 


     } 
     } 
    ) ; 

    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() 
    { 
     public void onClick(DialogInterface dialog, int id) 
     {   


      } 
     } 
    ); 


    AlertDialog alert = builder.create(); 
    alert.show(); 

감사합니다 ...

관련 문제