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.util.DisplayMetrics;

public class Main {
    public static final float getNormalTextSize(Context context) {
        DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        switch (metrics.densityDpi) {
        case DisplayMetrics.DENSITY_HIGH:
            return 18;
        case DisplayMetrics.DENSITY_XHIGH:
            return 24;
        case DisplayMetrics.DENSITY_XXHIGH:
            return 32;
        case DisplayMetrics.DENSITY_XXXHIGH:
            return 48;
        default:
            return 12;
        }
    }
}