Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.view.View; import android.view.ViewGroup; public class Main { /** * Invalidates a view and all of its descendants. */ private static void recursiveInvalidate(View view) { view.invalidate(); if (view instanceof ViewGroup) { ViewGroup group = (ViewGroup) view; int childCount = group.getChildCount(); for (int i = 0; i < childCount; i++) { View child = group.getChildAt(i); if (child.getVisibility() == View.VISIBLE) { recursiveInvalidate(child); } } } } }