Friday, 15 January 2010

android - Alertbox closing Automatically before Intent -


Text after "div class =" itemprop = "text">

I want to show an alert box before my activity. After clicking the "OK" button should work only with intent but my case alertsbox If you want to show in the show then intend to work immediately My intention is to stop automatically before the intent. This is my activity code

  alert.showAlertDialogpostive (ChangePass.this, "successfully copied", "password successfully changed", correct); UserFunctions userFunction = New UserFunctions (); UserFunction.logoutUser (getApplicationContext ()); Intent dashboard = new intent (getApplicationContext (), login variability. Class); // Close all the scenes before starting the dashboard dashboard.Edflag (Intent.FLAG_ACTIVITY_CLEAR_TOP); StartActivity (dashboard); // Close the registration screen (finish);  

and this is my warning builder class

  @SuppressWarnings ("protest") public zero showAlertDialogpostive (reference reference, string title, string message, boolean status ) {Ultimate Alert Demo Alert Dialogue = New AlertDialog. Builder (reference) .create (); // Set Dialog Header Alert Dialog.setTitle (title); AlertDialog.setCancelable (wrong); // Set Dialog Message Alert Dialog.setMessage (Message); If (position! = Null) // Set alert alert icon warning Dialog.setIcon ((position)? R.drawable.success: R.drawable.success); // Installation OK button alertDialog.setButton ("OK", New DialogInterface.OnClickListener () {Public Zero onClick (Final DialogInterface dialogue, final integer) {alertDialog.dismiss ();}}); // warning message warning is showing dialog.show (); }  

The intent should work only after clicking on the OK button in the alert box.

  UserFunctions userFunction = new UserFunctions (); UserFunction.logoutUser (getApplicationContext ()); Intent dashboard = new intent (getApplicationContext (), login variability. Class); // Close all the scenes before starting the dashboard dashboard.Edflag (Intent.FLAG_ACTIVITY_CLEAR_TOP); StartActivity (dashboard); // Close the registration screen (finish);  

Move the code upwards within the button clicks of the alert. Then look at your code like below,

  @SuppressWarnings ( "resistance") public void showAlertDialogpostive (REFERENCES, String title, String message, boolean state) {final AlertDialog alertDialog = new AlertDialog.Builder (Reference) .create (); // Set Dialog Header Alert Dialog.setTitle (title); AlertDialog.setCancelable (wrong); // Set Dialog Message Alert Dialog.setMessage (Message); If (status! = NULL) // alert setting dialog icon warning DialogksetIcon ((position)? R.drawable.success: R.drawable.success); // set the OK button alertDialog.setButton ( "OK", the new DialogInterface.OnClickListener () {public void onClick (Last DialogInterface communicate, final int which) {UserFunctions userFunction = new UserFunctions (); userFunction.logoutUser (getApplicationContext ()) ; effect dashboard = new intent (getApplicationContext (), LoginActivity.class); // start off dashboard dashboard.addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP) from the scene; startActivity (dashboard); // (closed registration screen finish first);} }); // warning message warning is showing dialog.show (); }  

No comments:

Post a Comment