List of usage examples for android.view View findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:Main.java
@SuppressWarnings("unchecked") public static <T extends View> T getView(View parent, int viewId) { return (T) checkView(parent.findViewById(viewId)); }
From source file:Main.java
@SuppressWarnings("unchecked") public static final <E extends View> E getView(View parent, int id) { try {//www .ja v a 2s. co m return (E) parent.findViewById(id); } catch (ClassCastException ex) { //Logger.e("Could not cast View to concrete class \n" + ex.getMessage()); throw ex; } }
From source file:Main.java
public static void setText(View itemView, int textViewId, String text) { ((TextView) itemView.findViewById(textViewId)).setText(text); }
From source file:Main.java
@SuppressWarnings("unchecked") public static final <E extends View> E getView(View parent, int id) { try {// w w w . j a v a2s. c o m return (E) parent.findViewById(id); } catch (ClassCastException ex) { Log.e("ImagPageUtil", "Could not cast View to concrete class \n" + ex.getMessage()); throw ex; } }
From source file:Main.java
public static View ensureInflation(View view, int stubResId, int inflatedId) { View stub = view.findViewById(stubResId); if (stub instanceof ViewStub) { return ((ViewStub) stub).inflate(); } else {/*from w w w .j av a 2 s . c o m*/ return view.findViewById(inflatedId); } }
From source file:Main.java
public static View findViewByIdOrReturnNull(View parentView, int id) { try {/*ww w.ja va 2s .c o m*/ View aView = parentView.findViewById(id); return aView; } catch (NoSuchFieldError e) { return null; } }
From source file:Main.java
public static void setSpinnerSelectionWithIndex(View view, int spinnerId, int index) { Spinner spinner = (Spinner) view.findViewById(spinnerId); spinner.setSelection(index);//from ww w . ja v a2 s . c o m }
From source file:Main.java
public static void setEditError(View view, int editId, String msg) { EditText editText = (EditText) view.findViewById(editId); editText.setError(msg);//from www. ja v a 2 s. c o m }
From source file:Main.java
public static void setEditViewText(View view, int textId, String text) { EditText editText = (EditText) view.findViewById(textId); editText.setText(text);//from w w w . j av a2s .c o m }
From source file:Main.java
public static void setEditText(View view, int editId, String text) { EditText editText = (EditText) view.findViewById(editId); editText.setText(text);// w w w . j a va2s .co m }