views:

34

answers:

1

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 is clicked? That would certainly be a lot quicker and slicker and shorter than writing the equivalent Java code to handle the event.

Peter

+2  A: 

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.

skyman