-2

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.

1 Answers1

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