industrychanger
industrychanger

Reputation: 573

Android display getSize() before API level 13

What would be the equivalent of the getSize() method pre-API level 13? Specifically, I need something that would work with Gingerbread.

Context context = getActivity();
Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Point size = new Point();
display.getSize(size);

Upvotes: 4

Views: 1066

Answers (1)

Serafins
Serafins

Reputation: 1247

Try:

width=display.getWidth();
height=display.getHeight();

when target is >= Gingerbread

Upvotes: 3

Related Questions