android--Click on the dialog box button does not close the dialog box

Source: Internet
Author: User

Sometimes I don't have to do some checking by clicking on the button. But do not want to close the dialog box (the system by default click on any button to close the dialog box), processing methods such as the following: Under the Click event to add such as the following code:
  1. Try
  2. {
  3. Field field = Dialog.getclass ()
  4. . Getsuperclass (). Getdeclaredfield (
  5. "Mshowing");
  6. Field.setaccessible (true);
  7. Set the mshowing variable to false. Indicates that the dialog box is closed
  8. Field.set (dialog, false);
  9. Dialog.dismiss ();
  10. }
  11. catch (Exception e)
  12. {
  13. }

Add the above code to which button's Click event code, which button can no longer close the dialog box.

Suppose you want to close the dialog box, just set mshowing to true. Note that setting the mshowing variable in a button also affects the ability to close the dialog box with a button, so you need to set the value of the mshowing variable in each button's Click event.

android--Click on the dialog box button does not close the dialog box

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.