简体   繁体   中英

sometimes showDialog doesn't work

I have a fragmentActivity that use startActivityForResult(intent, getCode) to call an activity that sends some files via ftp.

In the method onActivityResult(int requestCode, int resultCode, Intent data) shows the result of the operation (failure, success, no internet, etc...) using a dialog .

The dialog is called like this:

Bundle bundle = new Bundle();
bundle.putString(LLAVE_TITULO, alertTitulo);
bundle.putString(LLAVE_MENSAJE, alertMensaje);
showDialog(DIALOG_RESPUESTA, bundle);

and the onCreateDialog method is basic

@Override
protected Dialog onCreateDialog(int id, Bundle bundle)
{
    Builder mAlertDialog = new AlertDialog.Builder(this);
    mAlertDialog.setTitle(bundle.getString(LLAVE_TITULO));
    mAlertDialog.setMessage(bundle.getString(LLAVE_MENSAJE));
    mAlertDialog.setPositiveButton("Aceptar",null);
    return mAlertDialog.create();
}

Everything is working ok, but I noticed when I show and dismiss the dialog really fast (the faster i can, once or twice per second) in some point the dialog doesn't show anymore until I close the activity and start it again...

What is happening here? How can I really be sure that the dialog will show?

Thanks!

活动为每个对话框调用onCreateDialog()一次。....我认为您应该使用DialogInterface.OnShowListener进行对话框视图小部件验证

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM