Question in the title) Help me, please)
I want to make from this
that
I tried implement it's.
mProgressDialog = new ProgressDialog(this);
mProgressDialog.getWindow().setContentView(R.layout.footcloth);
mProgressDialog.setMessage(Constants.PROGRESS_DIALOG_MESSAGE);
mProgressDialog.show();
But this code throwing exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{im.anticafe.anticafeim/im.anticafe.anticafeim.activities.HomeActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
This code implements in activity BottomBarActivity
abstract public class BottomBarActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = "bottomBarActivity";
private int mWidth;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mProgressDialog = new ProgressDialog(this);
mProgressDialog.getWindow().setContentView(R.layout.footcloth);
mProgressDialog.setMessage(Constants.PROGRESS_DIALOG_MESSAGE);
mProgressDialog.show();
...
}
...
}
And this activity are extending in others. So, help me solve my problem, please) Thanks)
There are 2 answers
after complete reload, you can switch back again, or to another fragment
If you wanna change progress dialog
public class TransparentProgressDialog extends Dialog {
public TransparentProgressDialog(Context context) {
super(context, R.style.TransparentProgressDialog);
WindowManager.LayoutParams wlmp = getWindow().getAttributes();
wlmp.gravity = Gravity.CENTER_HORIZONTAL;
getWindow().setAttributes(wlmp);
setTitle(null);
setCancelable(false);
setOnCancelListener(null);
View view = LayoutInflater.from(context).inflate(
R.layout.progress_dialog, null);
setContentView(view);
}
}
In your activity use
TransparentProgressDialog pd = new TransparentProgressDialog(context);
pd.show();
....
if (pd.isShowing()){
pd.dismiss();
}