Android examples for android.view.animation:Show Animation
show View With Animation in UI thread
import android.app.Activity; import android.view.View; import android.view.animation.AnimationUtils; public class Main { public static void showViewWithAnim(final View view, final int anim, final int delay) { new Thread(new Runnable() { @Override//from ww w . j a va2s . c om public void run() { sleep(delay); ((Activity) view.getContext()).runOnUiThread(new Runnable() { @Override public void run() { view.setVisibility(View.VISIBLE); view.startAnimation(AnimationUtils.loadAnimation(view.getContext(), anim)); } }); } }).start(); } private static void sleep(int millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); } } }