Sometimes you want to start an Activity by pressing a Button.
Is there a way to express that in XML? I.e. to tag the Button xml with the Activity to render when it i开发者_运维知识库s clicked? That would certainly be a lot quicker and slicker and shorter than writing the equivalent Java code to handle the event.
Peter
In xml you can only set name of method that will be started on click event (same as setOncClickListener ) using http://developer.android.com/reference/android/view/View.html#attr_android:onClick
But it's not possible to define exactly what will be done after button click.
精彩评论