Guest User

Untitled

a guest
Oct 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="fill_parent"
  3. android:layout_height="wrap_content"
  4. android:orientation="vertical">
  5. <RadioButton android:id="@+id/physic"
  6. android:layout_width="match_parent"
  7. android:layout_height="wrap_content"
  8. android:text="physic"
  9. android:onClick="onRadioButtonClicked"/>
  10. <RadioButton android:id="@+id/math"
  11. android:layout_width="match_parent"
  12. android:layout_height="wrap_content"
  13. android:text="math"
  14. android:onClick="onRadioButtonClicked"/>
  15. </RadioGroup>
  16. <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
  17. android:layout_width="fill_parent"
  18. android:layout_height="wrap_content"
  19. android:orientation="vertical">
  20. <RadioButton android:id="@+id/theories"
  21. android:layout_width="match_parent"
  22. android:layout_height="wrap_content"
  23. android:text="theories"
  24. android:onClick="onRadioButtonClicked"/>
  25. <RadioButton android:id="@+id/problems_solving"
  26. android:layout_width="match_parent"
  27. android:layout_height="wrap_content"
  28. android:text="problem solving"
  29. android:onClick="onRadioButtonClicked"/>
  30. </RadioGroup>
  31.  
  32. public void onRadioButtonClicked(View view) {
  33. boolean checked = ((RadioButton) view).isChecked();
  34.  
  35. switch(view.getId()) {
  36. case R.id.math:
  37. if (checked)
  38. switch(view.getId()) {
  39. case R.id.problems_solving:
  40. if (checked)
  41. showFirstWord("math problem resolution");
  42. break;
  43. case R.id.theories:
  44. if (checked)
  45. showSecondWord("math theories");
  46. break;
  47. }
  48. break;
  49.  
  50. case R.id.physic:
  51. if (checked)
  52. switch(view.getId()) {
  53. case R.id.problems_solving:
  54. if (checked)
  55. showThirdWord("physic problem solving");
  56. break;
  57. case R.id.theories:
  58. if (checked)
  59. showFourthWord("physic theories");
  60. break;
  61. }
  62. break;
  63. }
  64. }
  65.  
  66. private void showFirstWord (String text) {
  67. Intent first_word = new Intent(this, FirstActivity.class);
  68. first_word.putExtra("key", text);
  69. startActivity(first_word);
  70. }
  71. private void showSecondWord (String text) {
  72. Intent second_word = new Intent(this, SecondActivity.class);
  73. second_word.putExtra("key", text);
  74. startActivity(second_word);
  75. }
  76. private void showThirdWord (String text) {
  77. Intent third_word = new Intent(this, ThirdActivity.class);
  78. third_word.putExtra("key", text);
  79. startActivity(third_word);
  80. }
  81. private void showFourthWord (String text) {
  82. Intent fourth_word = new Intent(this, FourthActivity.class);
  83. fourth_word.putExtra("key", text);
  84. startActivity(fourth_word);
  85. }
Add Comment
Please, Sign In to add comment