Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.graphics.Point;

import android.util.DisplayMetrics;

public class Main {
    public static int getViewWidth(Context ctx) {
        return getScreenPoint(ctx).x;
    }

    public static Point getScreenPoint(Context ctx) {
        DisplayMetrics dm = ctx.getResources().getDisplayMetrics();
        Point point = new Point(dm.widthPixels, dm.heightPixels);
        return point;
    }
}