Java tutorial
//package com.java2s; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.view.View; public class Main { public static void setViewVisibilityOnMainThread(final View paramView, int paramInt) { new Handler(Looper.getMainLooper()) { public void handleMessage(Message paramAnonymousMessage) { paramView.setVisibility(paramAnonymousMessage.what); } }.sendEmptyMessage(paramInt); } }