package com.alertDialogText;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
public class AlertDialogText extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// ダイアログのオブジェクト(dlg) 生成
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
// ダイアログにタイトルを指定
dlg.setTitle("タイトル");
// ダイアログにチェックボックスを指定
final CharSequence[] items = {"Red", "Green", "Blue"};
final boolean[] checkedItems = {true, false, true};
dlg.setMultiChoiceItems(items, checkedItems,
new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog, int which,
boolean isChecked) {
checkedItems[which] = isChecked;
}
});
// ダイアログを表示
dlg.show();
}
}
ボタンと併用するのがいいかも

0 件のコメント:
コメントを投稿