Sergey Nn Sergey Nn - 8 days ago 6
Java Question

I want to write more shorter with butterknife

It is views more shorter:

@BindViews({android.R.id.text1,android.R.id.text2})
TextView textEmail,description;


Than:

@BindViews(android.R.id.text1)
TextView textEmail;

@BindView(android.R.id.text2)
TextView description;


But it is incorrect. Can you help me, i want to know it is exist something looks like in butter knife?

Answer

I think you might be binding the android ids rather than your view ids.

Change android.R.id.text1 to R.id.yourText.

To group views, you can groups them into list/array:

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

Cheers~

Source: http://jakewharton.github.io/butterknife/

Comments