Android How to - Get Display from Context








Question

We would like to know how to get Display from Context.

Answer

/*from  www.  j a  va2  s. com*/
import android.content.Context;
import android.view.Display;
import android.view.WindowManager;

public class Main {
  public static Display getWindowDisplay(Context context){
    return ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); 
  }
}