Here you can find the source of getDisplayWidth(Context context)
public static synchronized int getDisplayWidth(Context context)
//package com.java2s; import android.content.Context; import android.view.Display; import android.view.WindowManager; public class Main { public static synchronized int getDisplayWidth(Context context) { Display display = ((WindowManager) context .getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay();// w w w . j a v a 2 s . c o m return display.getWidth(); } }