Example usage for android.app Activity findViewById

List of usage examples for android.app Activity findViewById

Introduction

In this page you can find the example usage for android.app Activity findViewById.

Prototype

@Nullable
public <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds a view that was identified by the android:id XML attribute that was processed in #onCreate .

Usage

From source file:Main.java

public static View getRootView(Activity activity) {
    return ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
}

From source file:Main.java

public static View getActivitySetContentView(Activity activity) {
    return ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
}

From source file:Main.java

public static View getMenuItemView(Activity activity, MenuItem item) {
    return activity.findViewById(item.getItemId());
}

From source file:Main.java

public static <T> T findViewById(Activity activity, int id) {
    return (T) activity.findViewById(id);
}

From source file:Main.java

public static View getAppContentView(Activity activity) {
    final View appView = activity.findViewById(android.R.id.content);
    return appView;
}

From source file:Main.java

/** Find the root view for a given activity. */
public static View getRootView(Activity activity) {
    return activity.findViewById(android.R.id.content).getRootView();
}

From source file:Main.java

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

From source file:Main.java

@SuppressWarnings("unchecked")
public static <T extends View> T getView(Activity activity, int id) {
    return (T) activity.findViewById(id);
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static <T extends View> T getViewOrNull(Activity parent, int viewId) {
    return (T) parent.findViewById(viewId);
}

From source file:Main.java

public static Button get_button(Activity activity, int id) {
    Button b = (Button) activity.findViewById(id);
    return b;// w ww  . j  a  va  2s.c  om
}