The example in this article describes how Android creates an alert box. Share to everyone for your reference. Specifically as follows:
Package com.akwolf.android;
Import android.app.Activity;
Import Android.app.AlertDialog;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.widget.Button;
The public class Dialogactivity extends activity {/** called the ' when ' is the ' The activity ' is a
-a-created.
@Override public
void OnCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (r.layout.main);
DIALOGBTN = (Button) Findviewbyid (r.id.button1);
Dialogbtn.setonclicklistener (New Onclicklistener () {
@Override public
void OnClick (View v) {
new Alertdialog.builder (dialogactivity.this).
SetIcon (R.drawable.icon). Settitle ("infomation")
. Setmessage ("Hello World"), Show ();}}
I hope this article will help you with your Android program.