Android Buffet Control Annotated IOC

Source: Internet
Author: User

Android Buffet Control Annotated IOC

    • Android Buffet Control Annotated IOC
      • Supported events
      • Use steps

Supported Events:
    • OnCheckedChanged ()
    • OnClick ()
    • Oneditoraction ()
    • Onfocuschange ()
    • Onitemclick ()
    • Onitemlongclick ()
    • Onitemselected ()
    • Onlongclick ()
    • Onpagechange ()
    • OnTextChanged ()
    • OnTouch ()
Use steps
    1. First add in the build.gradle
      compile ‘com.jakewharton:butterknife:7.0.1‘
    2. It is then called in the oncreate of the activity
      ButterKnife.bind(this);
    3. You can then use annotations to bind controls or click events.

      public class MainActivity extends AppCompatActivity {
      @Bind(R.id.tv_test1) TextView tvT1;
      @Bind(R.id.tv_test2) TextView tvT2;
      @Bind(R.id.tv_test3) TextView tvT3;
      @Bind(R.id.tv_test4) TextView tvT4;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      ButterKnife.bind(this);
      tvT1.setText("text");
      }
      @OnClick({R.id.tv_test1,R.id.tv_test2})
      void test1Clicked(View v){
      Toast.makeText(this,v.getId()+"",Toast.LENGTH_SHORT).show();
      }
      }

Android Buffet Control Annotated IOC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.