Problems encountered in the work of adapter in the list of position position confusion

Source: Internet
Author: User

The series of problems encountered in the work after the completion of each iteration of my project, the project manager gives the time to summarize the problems encountered in this work, think of their own difficulties, technical points to summarize. Then think of the blog, a few of these things, that they are growing up, learned some of their own things will not, later encountered related problems will be solved. This problem: Adapter in the list of position position confusion, I hit the log found that the first position of the list position should be 0, but the log shows a true 7, and then continue to check the cause of the problem, online search, ask colleagues, and finally found that the problem appeared in their own aspects.

The main reason for this problem is that I did not take all the circumstances into account when I wrote my own code, which caused the logic to go wrong. Project requirements, add unsubscribe business, in the View list of some business can be unsubscribe, some not, I need to put back the button to display, and non-refundable hidden. However, in my XML file, the default setting of the Unsubscribe button is set to gone, and then when I write the code in adapter, I only add the if (unsubscribe) {unsubscribe button display} statement, and do not add the Else statement, which causes the contents of the if () to be repeatedly called, which makes the position position chaotic. Finally change the code to if (can unsubscribe) {The Unsubscribe button shows that the}else{unsubscribe button is not displayed} The problem is solved. When this problem occurs because it is assumed that the default button in the XML file is gone, then only the display can be unsubscribe, but forget the adapter is not aware of a data, but a set of data. I hope that I will not make such mistakes in the future, logic analysis should take into account all kinds of situations.

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.