Accounts of Huaxia Edition set Cheng Zhijia Card reader-androidannotations Frame Association

Source: Internet
Author: User

Let's first look at a piece of code:

In Android development Findviewbyid is the most common method used to instantiate the controls on the page, basically every control needs to be called once, to join our page there are 100 need to use, then Findviewbyid will write 100 times, Plus the control variable declaration that is 200 lines of code, the same code repeated calls really no meaning, can not be called, can you just declare a variable on it? Only the unexpected, not do not do. Androidannotations, the sample code is as follows:

To implement such a requirement an input box, click the button, the input box to display the input content:

Package Com.handpay;import Android.app.activity;import Android.widget.button;import android.widget.edittext;import Android.widget.textview;import Com.googlecode.androidannotations.annotations.click;import Com.googlecode.androidannotations.annotations.eactivity;import Com.googlecode.androidannotations.annotations.notitle;import Com.googlecode.androidannotations.annotations.ViewById, @EActivity (r.layout.activity_main) @NoTitlepublic class Mainactivity extends Activity {@ViewById EditText myinput; @ViewById TextView mytextview; @ViewByIdButton MyButton;   @Click public void MyButton () {Mytextview.settext (Myinput.gettext (). toString ());}    }

This is achieved, haha!!

Accounts of Huaxia Edition set Cheng Zhijia Card reader-androidannotations Frame Association

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.