Unable to see custom progress dialog on dialog fragment
Custom progress dialog works in Activity and Fragment but when we try to show custom progress in Dialog Fragment then loader is not showing.
Here is my code of custom dialog.
/**
* A simple {@link Fragment} subclass.
*/
public class CustomAlertDialogFragment extends Dialog {
/**
* Instantiates a new Custom alert dialog fragment.
*
* @param context the context
* @param text the text
*/
public CustomAlertDialogFragment(Context context, String text) {
super(context, android.R.style.Theme_Holo_Dialog_NoActionBar);
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ProgressBar v = new ProgressBar(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(v);
setCancelable(false);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}
}
And my code for showing loader is
/**
* Loading bar.
*
* @param enable the enable
*/
public void loadingBar(boolean enable) {
if (enable) {
if (progressDialog == null) {
progressDialog = new CustomAlertDialogFragment(getActivity(), "");
}
if (!progressDialog.isShowing())
progressDialog.show();
} else {
dismissProgressBar();
}
}
/**
* Dismiss progress bar.
*/
public void dismissProgressBar() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
I am calling loader as
loadingBar(true);
File source = new File("/mnt/extSdCard/Audio");
File dest = new File("/mnt/UsbDriveA/Dokita");
copyDirectory(source, dest);
loadingBar(false);