Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.util.AttributeSet;

public class Main {
    public static int getIntAttribute(final Context context, final AttributeSet attrs, final String namespace,
            final String name, final int defValue) {
        final int resId = attrs.getAttributeResourceValue(namespace, name, Integer.MIN_VALUE);
        if (resId != Integer.MIN_VALUE) {
            final String string = context.getResources().getString(resId);
            try {
                return Integer.parseInt(string);
            } catch (final NumberFormatException e) {
            }
        }
        return attrs.getAttributeIntValue(namespace, name, defValue);
    }
}