Implement an entry form in an activity for entering student information:
name, school grade, gender, and scholarship (is the student on scholarship).
Show a confirmation on a second activity.
Directions:
Create an Android project with name StudentEntryForm as an Empty Activity.
Leave the layout as ConstraintLayout.
Set up a second activity with layout file activity_confirmation.xml
and Java activity file
ConfirmationActivity.java. This new layout has
four text views that display the name, grade, gender, and scholarship sent from the first activity.
Drag these widgets from the palette onto the activity_main.xml layout and set constraints for them with ConstraintLayout:
An EditText widget with id=edtxt_name, and hint
Enter Name:.
A Spinner container widget with id=spnGrade. Set up
this string array in strings.xml:
Drag a RadioButtonGroup from the palette onto the layout. Drag two
RadioButton widgets from the palette onto the
RadioButton group in the Component Tree. Set the id and text for the first
radio button to rad_female and Female. Set the id and text for the
second button to rad_male and Male.
Drag a CheckBox from the palette onto the layout.
Set the id to chk_scholarship and the text to
Scholarship?
Drag a Button widget from the palette onto the layout.
Drag a TextView widget from the onto the layout. Set the id to
txt_output. This text view is temporary to check if the
event handler is obtaining the values from the widgets correctly.
Write an onClick event handler for the button that obtains the current settings of the widgets and displays them in the
output textview. Use the getSelected method to get the
selected item from the spinner; use the isChecked method to see which radio
button and checkbox are selected.
Look at the SendMessage Example to remember how to set up and use an Intent to
start the second activity, pass the data to it, and display the information on
the second activity.