List of usage examples for android.app Activity findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:Main.java
private static void setRootView(Activity activity) { ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); rootView.setFitsSystemWindows(true); rootView.setClipToPadding(true);/* w w w. j av a 2s .c om*/ }
From source file:Main.java
public static void setRootView(Activity activity) { ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); rootView.setFitsSystemWindows(true); rootView.setClipToPadding(true);// w w w .java2s . c o m }
From source file:Main.java
public static void updateRight(Activity activity, int viewId, int resourceId) { View view = activity.findViewById(viewId); updateRight(view, resourceId);/*from ww w . j av a 2 s . c om*/ }
From source file:Main.java
/** * E.g. when using previous-next facility you need to make sure the scroll view's position is back at the top of the screen *//* w w w .j a v a 2 s. co m*/ public static void scrollToTop(int scrollViewId, Activity activity) { ScrollView sv = (ScrollView) activity.findViewById(scrollViewId); sv.fullScroll(View.FOCUS_UP); sv.setSmoothScrollingEnabled(true); }
From source file:Main.java
public static void updateLeft(Activity activity, int viewId, int resourceId) { View view = activity.findViewById(viewId); updateLeft(activity, view, resourceId); }
From source file:Main.java
public static boolean isFragmentInTop(Activity activity, int fragmentLayoutId) { View rootView = activity.findViewById(android.R.id.content); return rootView != null && rootView.findViewById(fragmentLayoutId) != null; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) private static void setRootView(Activity activity) { ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); rootView.setFitsSystemWindows(true); rootView.setClipToPadding(true);/*from w w w . j ava 2s . c om*/ }
From source file:Main.java
public static void setOnclickListener(Activity activity, int viewId, OnClickListener listener) { View view = activity.findViewById(viewId); if (view == null) { return;/* w w w . ja v a 2 s . c o m*/ } view.setOnClickListener(listener); }
From source file:Main.java
public static void putTextToViewById(Activity a, int id, int text) { View view = a.findViewById(id); Method m = null;//from www . j a va 2 s . com try { m = view.getClass().getMethod("setText", new Class[] { Integer.TYPE }); } catch (NoSuchMethodException e) { } if (m != null) { try { m.invoke(view, text); } catch (Exception e) { e.printStackTrace(); } } }
From source file:Main.java
public static TextView setText(Activity activity, int resourceId, String text) { TextView tv = (TextView) activity.findViewById(resourceId); if (text != null) { tv.setText(text);//from w w w . java 2s . c o m } return tv; }