Here you can find the source of switchVisible(ViewGroup viewGroup, int id)
public static void switchVisible(ViewGroup viewGroup, int id)
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void switchVisible(ViewGroup viewGroup, int id) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (view.getId() == id) { view.setVisibility(View.VISIBLE); } else { view.setVisibility(View.GONE); }/*from w w w. j a v a 2 s .co m*/ } } public static void switchVisible(ViewGroup viewGroup, View _view) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (_view == view) { view.setVisibility(View.VISIBLE); } else { view.setVisibility(View.GONE); } } } }