Androidannotations simple replication and click event (1), mui Click Event Replication

Source: Internet
Author: User

Androidannotations simple replication and click event (1), mui Click Event Replication

Now, the most popular android development framework briefly describes how to find controls and use events.

1. This method does not need to write setconteview.

@ EActivity (R. layout. activity_main)
Public class MainActivity extends Activity {

2. There are basically three methods to search for controls

/**
* Assignment
* 1. Simple value assignment using ViewById
* 2. assign values through @ ViewsById
* 3. @ AfterViews
*/

3. control display content

/**
* Simple assignment
* @ AfterViews this method cannot be used to assign values in oncreat. Otherwise, an error is returned.
*/

4. Bind events

1) Click the actual

2) Long press event

/**
* Click Event @ Click
*/
@ Click (R. id. textView1)
Public void TextViewCLick (){
Toast. makeText (this, "OK", 1). show ();
}
/**
* Long press event
*/
@ LongClick (R. id. button1)
Public void button1 (){
Toast. makeText (this, "OK", 1). show ();
}

Let's describe the listview click event.

Create a TwoActivity page

Note: Register in xml

And redirection Problems

TwoActivity _ Not TwoActivity

Item Click Event

Related Article

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.