|
Selecting Female & pushing DISPLAY ⇒ |
|
RadioButton in your layout.
However, because radio buttons are mutually exclusive, you must group them together inside a RadioGroup.
By grouping them together, the system ensures that only one radio button can be selected at a time.
RadioButton object receives an on-click event.
To define the click event handler for a button, add the android:onClick attribute to the RadioButton element in your XML layout.
The value for this attribute must be the name of the method you want to call in response to a click event.
The activity hosting the layout must then implement the corresponding method.
However, this example uses another approach.
|
|
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android = "http://schemas.android.com/apk/res/android"
package = "com.example.wenchen.myapplication">
<application
android:icon = "@mipmap/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/AppTheme">
<activity
android:name = ".MainActivity"
android:label = "@string/app_name">
<intent-filter>
<action android:name = "android.intent.action.MAIN" />
<category android:name = "android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
|