This article illustrates how Android is programmed to get the screen resolution size of a mobile phone. Share to everyone for your reference, specific as follows:
Import android.app.Activity;
Import Android.os.Bundle;
Import Android.util.DisplayMetrics;
Import Android.widget.TextView;
public class A03activity extends activity {
private TextView mTextView01;
/** called the activity is a. * *
@Override public
void OnCreate (Bundle savedinstancestate) {
super.oncreate (savedinstancestate);
Setcontentview (r.layout.main);
mtextview01= (TextView) Findviewbyid (r.id.mytextview01);
Displaymetrics dm=new displaymetrics ();
Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM);
The resolution of the String s= "screen is:" +dm.widthpixels+ "*" +dm.heightpixels;
Mtextview01.settext (s);
}
More interested readers of Android-related content can view this site: "Introduction to Android Development and advanced Tutorials", "Android mobile phone information How-to summary", "Android Control Usage Summary" and "The activity of Android programming techniques Summary"
I hope this article will help you with the Android program.