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