android - How to prevent custom dialog from popping twice in asynctask onPostExecute? -
I am using a custom dialog in the onpostexecute method in asyncTask, it is being popped twice when a user When the button clicks, the dialog should be closed, it works fine.
Is anyone being called this twice but some light can be highlighted?
@Override Secure Zero PostExecute (zero result) {super.onPostExecute (Results); If (pDialog! = Null) {pDialog.dismiss (); } Try {if (responseFromServer.contains ("x")) // // password to create the last dialog dialog pop up = new interface (getActivity ()); Dialog.setContentView (R.layout.dialog_password); Dialog.setTitle ("title ..."); Dialog.setCancelable (incorrect); Last TextView Atpassword = (TextView) Dialog.Findvibaid (RID.password_dialog); Last button btnpassword = (button) dialog. FindViewById (R.id.btnsavepassword_dialog); Btnpassword.setOnClickListener {@Override Click Public Zero (see V) {if (etpassword.getText (). ToString (). Length () == 0} {toast.makeText (getActivity (), "password" Enter ", Toast. LNGHHRT). Show ();} and if (etpassword.gate text). String (). Length () & lt; 6) {Toast. Make Text (getActivity), "Password must be a minimum size of 6 characters" Toast.LENGTH_SHORT). Show ();} and {dialog.dismiss ();}}}); If (! Dialog.is is showing ()) {dialog.show (); }} And {toast} MakeActivity (), "An unexpected error has occurred. Please try again", Toast. LNNGHHORT). Show (); }} Hold (exception e) {Log.v ("main limit FB async ::::::", e.getMessage ()); }}
You can write the following condition before displaying a custom dialog, click < / P>
If (! Dialog.is is showing ()) {dialog.show (); }
Comments
Post a Comment