List of usage examples for android.app Activity findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:Main.java
public static void setRootView(Activity activity, boolean fitsSystemWindows) { ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0); rootView.setFitsSystemWindows(fitsSystemWindows); rootView.setClipToPadding(fitsSystemWindows); }
From source file:Main.java
public static String getText(Activity activity, int resourceId) { String result = null;/*from ww w.j av a 2 s . c o m*/ EditText et = (EditText) activity.findViewById(resourceId); if (et != null) { result = et.getText().toString(); } return result; }
From source file:Main.java
private static void addTranslucentView(Activity activity, int statusBarAlpha) { ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content); if (contentView.getChildCount() > 1) { contentView.removeViewAt(1);//from w w w . j av a2 s . c o m } contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha)); }
From source file:com.landenlabs.flipanimation.Ui.java
public static final <E extends View> E viewById(Activity rootView, int id) { return (E) rootView.findViewById(id); }
From source file:Main.java
public static ImageView getImageViewFromUrl(String imageUrl, Activity activity, int viewId) { try {//from w w w .j a va 2 s.c o m ImageView i = (ImageView) activity.findViewById(viewId); Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(imageUrl).getContent()); i.setImageBitmap(bitmap); return i; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static <T extends View> T findViewById(Activity activity, int id) { @SuppressWarnings("unchecked") T v = (T) activity.findViewById(id); return v;//from ww w.j a va2 s . co m }
From source file:Main.java
public static void registerViews(Activity act, OnClickListener listener, int... ids) { for (int id : ids) { View v = act.findViewById(id); if (null != v) v.setOnClickListener(listener); }//from w w w . j ava2s . c om }
From source file:Main.java
public static void setTextView(Activity activity, int id, String text) { if (activity != null) { TextView tv = (TextView) activity.findViewById(id); if (tv != null && text != null) { tv.setText(String.valueOf(text)); }//from ww w . j a va2 s.c om } }
From source file:Main.java
public static View findSplitActionBar(Activity activity) { int id = activity.getResources().getIdentifier("split_action_bar", "id", "android"); return activity.findViewById(id); }
From source file:Main.java
public static View findActionBarContainer(Activity activity) { int id = activity.getResources().getIdentifier("action_bar_container", "id", "android"); return activity.findViewById(id); }