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.app.Activity;
import android.support.annotation.IdRes;
import android.view.View;

public class Main {

    public static <E extends View> E findViewById(Activity activity, @IdRes int resId) {
        //noinspection unchecked
        return (E) activity.findViewById(resId);
    }

    public static <E extends View> E findViewById(View view, @IdRes int resId) {
        if (null == view)
            throw new IllegalArgumentException("The argument view can not be null,please check your argument!");
        //noinspection unchecked
        return (E) view.findViewById(resId);
    }
}