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

public class Main {
    public static int getEditTextColor(Context ctx) {
        TypedValue tv = new TypedValue();
        boolean found = ctx.getTheme().resolveAttribute(android.R.attr.editTextColor, tv, true);
        if (found) {
            // SDK 11+
            return ctx.getResources().getColor(tv.resourceId);
        } else {
            // SDK < 11
            return ctx.getResources().getColor(android.R.color.primary_text_light);
        }
    }
}