Get Screen Resolution - Android User Interface

Android examples for User Interface:Screen Size

Description

Get Screen Resolution

Demo Code


import android.content.Context;
import android.util.DisplayMetrics;

public class Main {
  public static String GetResolution(Context context) {

    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    return displayMetrics.widthPixels + " * " + displayMetrics.heightPixels;
  }/*from   ww  w  . j a v a2 s  .c o m*/
}

Related Tutorials