Copy Code code as follows:
<span style= "font-size:18px" >private void Alertscreendialog () {
Displaymetrics dm = new Displaymetrics ();
Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM);
String optstr = "Mobile screen resolution:" +dm.widthpixels+ "X" +dm.heightpixels;
Builder Builder = new Builder (this);
Builder.setmessage (OPTSTR);
Builder.seticon (R.drawable.firefox);
Builder.settitle ("Get screen pixels");
Click OK button
Builder.setpositivebutton (OK), new Dialoginterface.onclicklistener () {
@Override
public void OnClick (Dialoginterface dialog, int which) {
Toast.maketext (Getscreenactivity.this, "Get to Pixel", Toast.length_long). Show ();
}
});
Builder.setnegativebutton ("Back", new Dialoginterface.onclicklistener () {
@Override
public void OnClick (Dialoginterface dialog, int which) {
Toast.maketext (Getscreenactivity.this, "back", Toast.length_long). Show ();
}
});
Builder.create (). Show ();
}</span>