Java tutorial
//package com.java2s; //License from project: Apache License import android.app.ProgressDialog; import android.os.Handler; import android.os.Looper; import android.util.Log; public class Main { public static boolean DEBUG = false; private static String TAG = "UXUtils"; private static StringBuffer sb = new StringBuffer(); private static ProgressDialog pd; private static void showProgressDialog2AutoClose(long betweenTIme) { pd.show(); new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { printMultiLog("fastRequestShowProgressDialog", "auto close start"); if (pd != null) { printMultiLog("fastRequestShowProgressDialog", "do auto close"); pd.hide(); } printMultiLog("fastRequestShowProgressDialog", "auto close end"); } }, betweenTIme); } public static void printMultiLog(String... msg) { if (msg != null && DEBUG) { sb.setLength(0); if (msg.length > 0) { for (String aMsg : msg) { sb.append(aMsg); sb.append(" "); } } else { sb.append("empty printMultiLog please check"); } Log.d(TAG, sb.toString()); } } }