Find bugs and Destroy series--record bugs encountered in Android development (i)

Source: Internet
Author: User
Tags event listener

The plugin that used Android studio directly binds the listener to the button and implements the OnClick method (my OnClick method, regardless of which one is to implement the Setcontentview method setting layout), After the OnClick method executes (that is, a new layout is set), clicking on the button in the new layout will bring up a toast, which I have first obtained through Findviewbyid in the OnCreate method, and then bind the listener for this button, but This is the way to bind the listener to cause me to click on the new layout before the OnClick method invalidation, click on the application has stopped the error prompt, this bug because I used the activity itself as the event listener class, and then, I think of the way to implement the onclick through the attributes of XML, the problem is solved, of course, the solution is not the only, there are other methods, the reader to explore the

Find bugs and Destroy series--record bugs encountered in Android development (i)

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.