Skip to content

Commit

Permalink
[Android] WINDOW_SERVICE should be accessed statically.
Browse files Browse the repository at this point in the history
(it's a static final variable in the Context class, so... yeah).
  • Loading branch information
lioncash committed Apr 24, 2013
1 parent 62ebfa0 commit bd284f1
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -9,6 +9,7 @@
import net.simonvt.menudrawer.MenuDrawer;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
Expand Down Expand Up @@ -135,7 +136,8 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
if (resultCode == Activity.RESULT_OK)
{
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(getApplicationContext().WINDOW_SERVICE); // the results will be higher than using the activity context object or the getWindowManager() shortcut
getApplicationContext();
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE); // the results will be higher than using the activity context object or the getWindowManager() shortcut
wm.getDefaultDisplay().getMetrics(displayMetrics);
screenWidth = displayMetrics.widthPixels;
screenHeight = displayMetrics.heightPixels;
Expand Down

0 comments on commit bd284f1

Please sign in to comment.