Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; public class Main { public static void showEmpty(Activity activity, boolean show, View emptyView) { Animation anim = AnimationUtils.loadAnimation(activity, show ? android.R.anim.fade_in : android.R.anim.fade_out); if (show && (emptyView.getVisibility() == View.GONE || emptyView.getVisibility() == View.INVISIBLE)) { emptyView.setAnimation(anim); emptyView.setVisibility(View.VISIBLE); } else if (!show && emptyView.getVisibility() == View.VISIBLE) { emptyView.setAnimation(anim); emptyView.setVisibility(View.GONE); } } }