I have been looking online and I have seen so many different examples of how to use butterknife for implementing onClick . I would just like someone to show my the simplest way of doing it from a beginners perspective.
Asked
Active
Viewed 375 times
-2
-
It sounds like you've already found many answers, why are you asking here? – samiles May 31 '17 at 08:41
-
Look here: jakewharton.github.io/butterknife/ – Satan Pandeya May 31 '17 at 08:43
1 Answers
0
Frank next time please show us an example of what you have tried so that we can guide you in the right direction.
below is a simple example and a link for you
step 1 .
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
step 2. (in your onCreate)
//must match the ID in your view
@BindView(R.id.btnRegister)
step 3. implement the onClick
@OnClick(R.id.btnRegister)
void onRegisterClicked()
{
//do whatever you need to do when the button is clicked
Intent intent = new Intent(this, RegisterActivity.class);
this.startActivity(intent);
}
also have a look at this link for a better insight on how butterknife works.

Zidane
- 1,696
- 3
- 21
- 35