<RadioGroup android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RadioButton android:id="@+id/rb10Above" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="10-17"/> <RadioButton android:id="@+id/rb18Above" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="18-30"/> <RadioButton android:id="@+id/rb31Above" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="31-Above"/> </RadioGroup> <CheckBox android:id="@+id/cbTermsConditions" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/terms_conditions"/> override fun onItemSelected(p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long) { showToast(p0?.getItemAtPosition(p2).toString()) } override fun onNothingSelected(p0: AdapterView<*>?) { } fun onSignUpClicked(view: View) { executeSignUp() } private fun executeSignUp(){ AlertDialog.Builder(this).apply { setTitle("Title") setMessage("RB 10 Above = ${rb10Above.isChecked}" + "\nRB 18 Above = ${rb18Above.isChecked}" + "\nRB 31 Above = ${rb31Above.isChecked}" + "\n\nTerms & Conditions = ${cbTermsConditions.isChecked}") setPositiveButton("Ok") { dialogInterface, i -> dialogInterface.dismiss() } setNegativeButton("Cancel") { dialogInterface, i -> dialogInterface.dismiss() } }.create().show() }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter