Android Screen Size Get getScreenWidth(Context context)

Here you can find the source of getScreenWidth(Context context)

Description

get Screen Width

Declaration

public static int getScreenWidth(Context context) 

Method Source Code

//package com.java2s;
import android.content.Context;

import android.util.DisplayMetrics;

import android.view.WindowManager;

public class Main {
    public static int getScreenWidth(Context context) {
        WindowManager manager = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics dm = new DisplayMetrics();
        manager.getDefaultDisplay().getMetrics(dm);
        return dm.widthPixels;
    }//from  www  .  java2 s .  c o  m
}

Related

  1. getDisplayWidth(Context context)
  2. getScreenHeight(Context context)
  3. getScreenHeight(Context context)
  4. getScreenHeight(Display display)
  5. getScreenPixel(Activity activity)
  6. getScreenWidth(Context context)
  7. getScreenWidth(Display display)
  8. getScreenSizePixels(Context ctx)
  9. getRealScreenDimensions(Context context)