Android in activity pops up a dialog box that does not perform the OnPause life cycle method

Source: Internet
Author: User

In the actual application development, we may carry on the network interaction in the Onresume, in the network interaction process inevitably uses the ProgressDialog, then now the question comes, When we pop up a progress dialog box, if our activity's OnPause life method is executed, then when the data is loaded and the dialog disappears, the activity's onresume is executed again, and then the network is requested again. Such a vicious circle began, such a mistake is too serious, of course, the above is only in my imagination, and then the code to experiment with, in the Pop up a dialog box when our activity's onpause is not executed, so it will not cause onresume repeated execution,

When we create the dialog box, we need to pass in a parameter of the context type. This parameter also shows that our dialog is created in this context, our activity is interacting, and does not perform OnPause

Android in activity pops up a dialog box that does not perform the OnPause life cycle method

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.