Copy codeThe Code is as follows: <SPAN style = "FONT-SIZE: 18px"> private void alertScreenDialog (){
DisplayMetrics dm = new DisplayMetrics ();
GetWindowManager (). getDefaultDisplay (). getMetrics (dm );
String optStr = "cell phone screen resolution:" + dm. widthPixels + "x" + dm. heightPixels;
Builder builder = new Builder (this );
Builder. setMessage (optStr );
Builder. setIcon (R. drawable. firefox );
Builder. setTitle ("getting screen pixels ");
// Click OK.
Builder. setPositiveButton ("OK", new DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog, int which ){
Toast. makeText (GetScreenActivity. this, "Get pixel", Toast. LENGTH_LONG). show ();
}
});
Builder. setNegativeButton ("return", new DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog, int which ){
Toast. makeText (GetScreenActivity. this, "Return", Toast. LENGTH_LONG). show ();
}
});
Builder. create (). show ();
} </SPAN>