Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.content.res.Resources;

import android.util.DisplayMetrics;

public class Main {
    /**
     * get mobile screen resolution
     * 
     * @param context
     * @return
     */
    public static String getScreenResolution(Context context) {
        Resources resources = context.getResources();
        DisplayMetrics metrics = resources.getDisplayMetrics();
        return metrics.heightPixels + "x" + metrics.widthPixels;
    }

    /** get Resources */
    public static Resources getResources(Context context) {
        return context.getResources();
    }
}