here is my code:
public class MainMenuActivity extends Activity implements OnClickListener {
public int width;
public int height;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mainmenu);
Button play = (Button) findViewById(R.id.playbut);
Button credits = (Button) findViewById(R.id.creditsbut);
Button help = (Button) findViewById(R.id.helpbut);
play.setOnClickListener(this);
credits.setOnClickListener(this);
help.setOnClickListener(this);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
width = dm.widthPixels;
height = dm.heightPixels;
}
the problem is, public int width is not getting being set to dm.widthPixels and likewise for height. Any tips?
dmproperties; what makes you think they're not?