Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <RadioButton android:id="@+id/physic"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="physic"
- android:onClick="onRadioButtonClicked"/>
- <RadioButton android:id="@+id/math"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="math"
- android:onClick="onRadioButtonClicked"/>
- </RadioGroup>
- <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <RadioButton android:id="@+id/theories"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="theories"
- android:onClick="onRadioButtonClicked"/>
- <RadioButton android:id="@+id/problems_solving"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="problem solving"
- android:onClick="onRadioButtonClicked"/>
- </RadioGroup>
- public void onRadioButtonClicked(View view) {
- boolean checked = ((RadioButton) view).isChecked();
- switch(view.getId()) {
- case R.id.math:
- if (checked)
- switch(view.getId()) {
- case R.id.problems_solving:
- if (checked)
- showFirstWord("math problem resolution");
- break;
- case R.id.theories:
- if (checked)
- showSecondWord("math theories");
- break;
- }
- break;
- case R.id.physic:
- if (checked)
- switch(view.getId()) {
- case R.id.problems_solving:
- if (checked)
- showThirdWord("physic problem solving");
- break;
- case R.id.theories:
- if (checked)
- showFourthWord("physic theories");
- break;
- }
- break;
- }
- }
- private void showFirstWord (String text) {
- Intent first_word = new Intent(this, FirstActivity.class);
- first_word.putExtra("key", text);
- startActivity(first_word);
- }
- private void showSecondWord (String text) {
- Intent second_word = new Intent(this, SecondActivity.class);
- second_word.putExtra("key", text);
- startActivity(second_word);
- }
- private void showThirdWord (String text) {
- Intent third_word = new Intent(this, ThirdActivity.class);
- third_word.putExtra("key", text);
- startActivity(third_word);
- }
- private void showFourthWord (String text) {
- Intent fourth_word = new Intent(this, FourthActivity.class);
- fourth_word.putExtra("key", text);
- startActivity(fourth_word);
- }
Add Comment
Please, Sign In to add comment