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.content.res.Resources;

import android.text.TextPaint;

import android.util.TypedValue;

public class Main {
    public static TextPaint setTextSize(Context c, TextPaint paint, float size) {
        Resources r;
        if (c == null) {
            r = Resources.getSystem();
        } else {
            r = c.getResources();
        }
        if (r != null) {
            paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, size, r.getDisplayMetrics()));
        }
        return paint;
    }
}