user6925398
user6925398

Reputation:

Error:(25, 46) error: @InjectViews must be a List or array

public class DailyForecastActivity extends ListActivity {

private Day[] mDays;

@InjectViews(android.R.id.list) ListView mListView;
@InjectViews(android.R.id.empty) TextView mEmptyTextView;

but when I debug , ı get error like that

Error:(25, 46) error: @InjectViews must be a List or array. (brah.mb.hanifiui.DailyForecastActivity.mListView)
Error:(26, 47) error: @InjectViews must be a List or array. (brah.mb.hanifiui.DailyForecastActivity.mEmptyTextView)

what is the error. if any information u need , ı can edit again.tnx.

Upvotes: 0

Views: 465

Answers (1)

Abhinav Puri
Abhinav Puri

Reputation: 4284

I suppose that you are using ButterKnife library. '@InjectViews' was used to inject several views as array.

eg :

@InjectViews({ R.id.first_name, R.id.middle_name, R.id.last_name })
List<EditText> nameViews; 

@InjectViews should be used only on List type or on an array of view objects. Other implementations are restricted.

You can also look at working code sample here.

So, you cannot use it the way you have defined, the error clearly states that, you need to use list or array. Moreover, look into new document, the thing that you are trying to do is simply the very first example, simply use @BindView, and if you want to bind multiple similar views at once, search for @BindViews on the same page itself.

Hope It helps !

Upvotes: 1

Related Questions