Final AlertDialog. Builder alert = new AlertDialog. Builder (
CloudSyncActivity. this );
Alert. setIcon (getResources (). getDrawable (R. drawable. about ));
Alert. setTitle ("title ");
Alert. setMessage ("input prompt information ");
Alert. setPositiveButton ("OK ",
New DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog,
Int which ){
// The control button does not disappear
Try
{
Field field = dialog. getClass ()
. GetSuperclass (). getDeclaredField (
"MShowing ");
Field. setAccessible (true );
// Set the mShowing variable to false, indicating that the dialog box is closed.
Field. set (dialog, false );
Dialog. dismiss ();
}
Catch (Exception e)
{
}
// Obtain the Button Object
Button PositiveButton = (AlertDialog) dialog). getButton (AlertDialog. BUTTON_POSITIVE );
// Operate the button
PositiveButton. setVisibility (View. GONE );
}
});
Alert. setNegativeButton ("cancel ",
New DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog,
Int which ){
Try
{
Field field = dialog. getClass ()
. GetSuperclass (). getDeclaredField (
"MShowing ");
Field. setAccessible (true );
// Set the mShowing variable to false, indicating that the dialog box is closed.
Field. set (dialog, true );
Dialog. dismiss ();
}
Catch (Exception e)
{
}
}
});
Alert. show ();