Android support Annotations: Android annotations get started quickly

Source: Internet
Author: User

As we all know, the Android resource file is an int type ID to save its reference, through the annotation type, we can write the code, the time to find the parameter type of error, avoid potential bugs, as follows:

By @LayoutRes We specify that the parameter must be in R.LAYOUT.XXX format, and the IDE will prompt us for errors

Introduction of annotation types into the project through Gradle

Compile ' com.android.support:support-annotations:23.1.1 '

Android native provides us with a range of annotation classes to support our development

Note Class Package location: Android SDK Path \extras\android\m2repository\com\android\support\support-annotations

We can find a 23.1.1 folder, find the inside of the Support-annotations-23.1.1-sources.jar, through Jd-gui view

With the class at the end of Res , we can limit the different types of Android resource IDs.

Inside other classes we can also look at, such as Nonnull, Nullable, limited scope Floatrange is also very interesting, as follows:

Android support Annotations: Android annotations get started quickly

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.