As of ADT 14, resource fields cannot be used as switch Cases

Source: Internet
Author: User

When importing the apidemos of the android sample, you find that the R. Id. XX file cannot be used in switch cases for Google query. Find the following answer:

As of ADT 14, resource fields cannot be used as switch cases.In other words, the constants are not final in a library project. the reason for this is simple: when multiple library projects are combined, the actual values of the fields (which must be unique) cocould collide. before ADT 14, all fields were final, so as a result, all libraries had to have all their resources and associated Java code recompiled along with the main project whenever they were used. this was bad for performance, since it made builds very slow. it also prevented distributing library projects that didn't include the source code, limiting the usage scope of library projects.
The solution is to change switch cases to If else, which can be used in eclipse. CTRL + 1Shortcut switch.

As of ADT 14, resource fields cannot be used as switch Cases

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.