■AlertDialog
AlertDialogは、コンストラクタがprivateになっており 直接 new 出来ないので注意!
AlertDialog.Builder経由で、new してやる必要がある
●通常のダイアログ表示
// ダイアログの表示
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setTitle("TEST");
dlg.setMessage("Hello, World!");
dlg.show();
●選択ダイアログの表示
AlertDialog.Builder dlg = new AlertDialog.Builder(this);
dlg.setIcon(R.drawable.icon);
dlg.setTitle("Select Dialog");
dlg.setMessage("選択してください");
dlg.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* YES 選択時の処理 */
}
});
dlg.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* NO 選択時の処理 */
}
});
dlg.show();
他にも、リストや複数の選択肢、プログレスバーなどを扱うことができる
■参考アドレス
http://www.hakkaku.net/articles/20090924-581
http://wikiwiki.jp/android/?UI%A