Here you can find the source of stallWithProgressDialog(Context context, String title, String msg, boolean indeter, boolean cancelable, int stallTime)
Parameter | Description |
---|---|
context | a parameter |
title | title of the progressDialog |
msg | message of the progressDialog |
indeter | if true progress percentage is not shown |
cancelable | dialog cancelable boolean |
stallTime | time to pause the UI |
public static void stallWithProgressDialog(Context context, String title, String msg, boolean indeter, boolean cancelable, int stallTime)
//package com.java2s; import android.app.ProgressDialog; import android.content.Context; public class Main { /**/*from www . ja va 2 s .c o m*/ * Function to stall the UI for given time. Used when server request * frequncy is too high. * * @param context * @param title * title of the progressDialog * @param msg * message of the progressDialog * @param indeter * if true progress percentage is not shown * @param cancelable * dialog cancelable boolean * @param stallTime * time to pause the UI */ public static void stallWithProgressDialog(Context context, String title, String msg, boolean indeter, boolean cancelable, int stallTime) { final ProgressDialog ringProgressDialog = ProgressDialog.show( context, title, msg, indeter); ringProgressDialog.setCancelable(cancelable); final int stalltime = stallTime; new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(stalltime); } catch (Exception e) { } ringProgressDialog.dismiss(); } }).start(); } }