4

I want to create

android @Nullable annotation

i check this two links for example

http://findbugs.sourceforge.net/api/edu/umd/cs/findbugs/annotations/Nullable.html http://code.google.com/p/google-guice/wiki/UseNullable

but none works in android because RetentionPolicy, ElementType is not valid

How can i create @Nullable annotation in android?

1

2 Answers 2

2

Include jsr-305 jar file in project libraries. Use @nullable with fields and RoboGuice will stop complaining about null objects.

Sign up to request clarification or add additional context in comments.

1 Comment

I try but hmm is the same.I can not create this notation that will work as it must
2

For Android Studio:

  • Add the following to build.gradle:

    dependencies { ... // For @Nullable/@NonNull compile 'com.android.support:support-annotations:+' } 
  • Go to File / SettingProject SettingsInspections and search for "nullable".

    In Constant conditions & exceptions and @NotNull/@Nullable problems, click Configure annotations and select Android's annotations.

    You may also want to check Suggest @Nullable annotations… under Constant conditions & exceptions, or possibly tweak other options.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.