The current mobile phone store on the resolution of the label is very careless, customers often say that the business of the hardware configuration does not recognize the ability. So my app is a good solution to the phone resolution of the recognition.
First open the control and use the intent class to jump to another activity
Button button= (button) Findviewbyid (R.id.button1);
Button.setonclicklistener (New Button.onclicklistener () {
public void OnClick (View v)
{
Intent Intent =new Intent ();
Intent.setclass (Mainactivity.this, Secondactivity.class);
StartActivity (Intent);
MainActivity.this.finish ();
}
Second, in another class to create the Displaymetrics class, you can get the phone resolution directly.
Displaymetrics dm=new displaymetrics ();
Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM);
String str= "Current phone screen resolution is:" +dm.widthpixels+ "*" +dm.heightpixels;
TextView textview= (TextView) Findviewbyid (R.ID.TEXTVIEW2);
Textview.settext (str);
Resolution tester-Step by step Android (1)