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)