Example usage for android.view View findViewById

List of usage examples for android.view View findViewById

Introduction

In this page you can find the example usage for android.view View findViewById.

Prototype

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

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:Main.java

public static Button getButton(View view, int id) {
    return (Button) view.findViewById(id);
}

From source file:Main.java

public static String getTVText(View v, int id) {
    return ((TextView) v.findViewById(id)).getText().toString();
}

From source file:Main.java

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

From source file:Main.java

public static <T extends View> T findViewsById(View parent, int viewId) {
    View view = parent.findViewById(viewId);
    return (T) view;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static EditText getEditText(View view, int id) {
    return (EditText) view.findViewById(id);
}

From source file:Main.java

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

From source file:Main.java

public static EditText getEditText(View view, int rid) {
    return (EditText) view.findViewById(rid);
}

From source file:Main.java

static public void enable(View v, int id, boolean b) {
    enable(v.findViewById(id), b);
}