Android Baseadapter loading multiple different item layouts occurs when uncaughtexception in Thread main java.lang.ArrayIndexOutOfBoundsException:length = 15; Index=15

Source: Internet
Author: User

java.lang.arrayindexoutofboundsexception:length=15; Index=15

Abnormal appearance: In the chat interface, you need to insert emoticons, pictures, text, business cards, and several more complex layouts. The Getviewtypecount () and getitemviewtype (int position) methods in Baseadapter are required, and this exception occurs when a complex interface is being sent.

The maddening is this anomaly incredibly is uncaughtexception, can not judge which line is wrong, just at the beginning of the thought must be array angle mark out of bounds (online also said), then is the troubleshooting, various troubleshooting. For one hours there was no one to come up with. On the way back in the evening, it occurred to me that Getviewtypecontent had a problem. The next day to check, item layout 16, and the value of Getviewtypecount only 15, obviously less one, changed to 16 after the program will be able to send and receive the normal.

Here is an article about Baseadapter and http://android.amberfog.com/?p=296, the comparison of the basis, but sometimes the inspiration is derived from the most basic things

Android Baseadapter loading multiple different item layouts occurs when uncaughtexception in Thread main java.lang.ArrayIndexOutOfBoundsException:length = 15; Index=15

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.