user9175219
user9175219

Reputation:

annotation value not of an allowable type rrror : illegal initializer for int

can some please tell me how to fix the issue with this code when i try to compile it error: annotation value not of an allowable type showsup at line 9

here is the code

public class SettingsFragment extends Fragment {
    public static final String APP_LINK = "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID;

    static final String KEY_COLOR_1 = "COLOR_1";
    static final String KEY_COLOR_2 = "COLOR_2";
    static final String KEY_COLOR_3 = "COLOR_3";
    static final String KEY_COLOR_4 = "COLOR_4";
    static final String KEY_COLOR_5 = "COLOR_5";
    @BindView ({R2.id.view_1, R2.id.view_2, R2.id.view_3, R2.id.view_4, R2.id.view_5})
    View[] views;
    private SharedPreferences preferences;

    public static SettingsFragment instance() {
        return new SettingsFragment();
    }

Upvotes: 0

Views: 502

Answers (2)

Bishoy Kamel
Bishoy Kamel

Reputation: 2355

first change @BindView to @BindViews

@BindViews({R.id.view_1, R.id.view_2, R.id.view_3, R.id.view_4, R.id.view_5 })
List<View> mViews;

according to JakeWharton notes.

use only R2 if you are making a library project.

also, make sure you inject your views ButterKnife.bind(this);

also, see this tutorial by jackWharton

Upvotes: 0

Raul
Raul

Reputation: 104

when its multipme use bindviews not bindview

R.id.view_1 not R2.id.view_1

i'm not sure what R2 is.

Use it like this :

@BindViews({R.id.view_1, R.id.view_2, R.id.view_3, R.id.view_4, R.id.view_5 })
List<View> myViews;

Upvotes: 2

Related Questions