Package com. example. MyApp;
Import Android. OS. Bundle;
Import Android. App. activity;
Import Android. util. displaymetrics;
Import Android. View. display;
Import Android. View. Menu;
Import Android. widget. textview;
Public class mainactivity extends activity {
@ Override
Protected void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
String LCD _info = "";
Display display = getwindowmanager (). getdefaultdisplay ();
Displaymetrics dm = new displaymetrics ();
Getwindowmanager (). getdefaultdisplay (). getmetrics (DM );
Int width = DM. widthpixels;
Int Height = DM. heightpixels;
Float density = DM. densitydpi;
LCD _info + = "\ n" + "Resolution:" + width + "*" + height;
LCD _info + = "\ n" + "screen density:" + density;
Textview WF = new textview (this );
WF. settext (LCD _info );
Setcontentview (WF );
}
@ Override
Public Boolean oncreateoptionsmenu (menu ){
// Inflate the menu; this adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R. Menu. Main, menu );
Return true;
}
}