Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.app.Activity;

import android.support.annotation.IdRes;
import android.view.View;

import android.view.Window;

public class Main {
    public static View getRootView(Window w) {
        return w.findViewById(android.R.id.content).getRootView();
    }

    public static <T extends View> T findViewById(Activity activity, @IdRes int id) {
        T v = (T) activity.findViewById(id);
        return v;
    }

    public static <T extends View> T findViewById(View parent, int id) {
        T v = (T) parent.findViewById(id);
        return v;
    }
}