Package gongzibai. co. cc;
Import android. app. Activity;
Import android. app. Dialog;
Import android. OS. Bundle;
Public class ProgressBarActivity extends
Activity {
/** Called when the activity is first created .*/
@ Override
Public void onCreate (
Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );
Dialog dialog = new Dialog (this );
Dialog. setTitle ("loveyou ");
// Set the view in the dialog box to create a new layout main1
Dialog. setContentView (R. layout. main1 );
// Outside the touch screen dialog box, the dialog box disappears
Dialog. setCanceledOnTouchOutside (true );
Dialog. show ();
}
}
----------------- AlertDialog
Final DialogInterface. OnClickListener closeDialog = new
DialogInterface. OnClickListener (){
@ Override
Public void onClick (
DialogInterface dialog,
Int which ){
// TODO Auto-generated method stub
Dialog. cancel ();
}
};
------------- AlertDialog attribute www.2cto.com
AlertDialog. Builder builder = new AlertDialog. Builder (
ProgressBarActivity. this );
Builder. setIcon (R. drawable. ic_launcher );
Builder. setTitle ("loveyou ");
Builder. setMessage ("great to see you ");
Builder. setNegativeButton (
"NO ",
CloseDialog );
Builder. setPositiveButton (
"OK ",
CloseDialog );
Builder. setNeutralButton (
"Cancel ",
CloseDialog );
Builder. create ()
. Show ();
By gongzibai