An Example analysis of Android check Box dialog box usage

  • 2020-12-19 21:12:21
  • OfStack

This paper gives an example to analyze the usage of Android check box dialog. To share for your reference, the details are as follows:


/**
*  Create a filter check box dialog box 
* @param guoguanglist  The league of 
* @param flags  Whether you choose 
* @create_time 2011-10-26  In the afternoon 3:59:54
*/
private void initFilterDialog(String[] iNamelist, final boolean[] iFlags) {
  Builder builder = new android.app.AlertDialog.Builder(this);
  builder.setTitle(" Screening event ");
  builder.setMultiChoiceItems(iNamelist, iFlags, new DialogInterface.OnMultiChoiceClickListener() {
   public void onClick(DialogInterface dialog, int which, boolean isChecked) {
    leagueNameChoice[which] = isChecked;
   }
  });
  // add 1 "Ok" button 
  builder.setPositiveButton(" determine ", new DialogInterface.OnClickListener() {
   public void onClick(DialogInterface dialog, int which) {
    filterLeagueNameResult();
   }
  });
  builder.setNegativeButton(" Shut down ", new DialogInterface.OnClickListener() {
   public void onClick(DialogInterface dialog, int which) {
   }
  });
  // create 1 Check box dialog box 
  dialog = builder.create();
  dialog.show();
}

I hope this article has been helpful in Android programming.


Related articles: