progressdialog.show() in android code example

Example 1: custom progressdialog android

private AlertDialog progressDialog;
progressDialog = new SpotsDialog(mContext, R.style.Custom);

//Am using it in an AsyncTask. So in  my onPreExecute, I do this:
public void onPreExecute() {
  super.onPreExecute();
  progressDialog.show();
  ...
 }

//dismiss in onPostExecute
public void onPostExecute(){
   progressDialog.dismiss();
 }

Example 2: custom progressdialog android

<style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
    <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
    <item name="DialogTitleText">Please Wait</item>
    <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
    <item name="DialogSpotCount">8</item>
</style>

Example 3: progressdialog not showing android

Instead of doing this in one function at once. Do the following steps and
it will definately work for you. 
1. Create one async class.
(It will create one separate thread for 
your copy directory functionality and wont run on main UI.) 
2. Show your progress dialog before you execute the async class. 
3. On post execute method, dismiss your dialog.

Tags:

Java Example