



public class AndroidsCastleActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("タイトル"); // タイトルを設定
builder.setMessage("メッセージ"); // メッセージを設定
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.d("Sample","OKを押した");
}
});
builder.setNegativeButton("NG", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Log.d("Sample","NGを押した");
}
});
AlertDialog dialog = builder.create(); // ビルダーの設定でダイアログを作る
dialog.show(); // ダイアログを表示
}
}
Portions of this page are modifications
based on work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License.
- Remical Soft -