Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.res.Resources;
import android.os.Build;

public class Main {
    public static int getColor(Resources resources, int resId) {
        if (resources == null || resId <= 0)
            return 0;

        try {
            return Build.VERSION.SDK_INT >= 23 ? resources.getColor(resId, null) : resources.getColor(resId);
        } catch (Resources.NotFoundException e) {
            e.printStackTrace();
            return 0;
        }
    }
}