Advertisement
Guest User

Untitled

a guest
May 24th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. public class DessertIngAvail extends Dessert {
  2.  
  3. ArrayList<String> selection = new ArrayList<String>();
  4. TextView final_text;
  5.  
  6. @Override
  7. protected void onCreate(Bundle savedInstanceState) {
  8. super.onCreate(savedInstanceState);
  9. setContentView(R.layout.activity_dessert_ing_avail);
  10.  
  11. final_text = (TextView)findViewById(R.id.final_result);
  12. final_text.setEnabled(false);
  13. }
  14.  
  15. public void selectItem(View view){
  16. boolean checked = ((CheckBox) view).isChecked();
  17. switch (view.getId())
  18. {
  19.  
  20. case R.id.checkBox181:
  21.  
  22. if(checked)
  23.  
  24. {
  25.  
  26. if(!selection.contains("Tebaloi"))
  27. selection.add("Tebaloi");
  28.  
  29. if(!selection.contains("Tumpik"))
  30. selection.add("Tumpik");
  31.  
  32. }
  33.  
  34. break;
  35.  
  36. case R.id.checkBox182:
  37.  
  38. if(checked)
  39.  
  40. {
  41.  
  42. if(!selection.contains("Ambuyat"))
  43. selection.add("Ambuyat");
  44.  
  45. }
  46.  
  47. break;
  48.  
  49. case R.id.checkBox183:
  50.  
  51. if(checked)
  52.  
  53. {
  54.  
  55. if(!selection.contains("Tumpik"))
  56. selection.add("Tumpik");
  57.  
  58. }
  59.  
  60. break;
  61.  
  62. case R.id.checkBoxCM:
  63.  
  64. if(checked)
  65.  
  66. {
  67.  
  68. if(!selection.contains("Honey Frankincense Cake"))
  69. selection.add("Honey Frankincense Cake");
  70.  
  71. if(!selection.contains(" Ray Heart Cake"))
  72. selection.add(" Ray Heart Cake");
  73.  
  74.  
  75. }
  76.  
  77. break;
  78.  
  79. }
  80. }
  81.  
  82. public void finalSelection(View view){
  83.  
  84.  
  85. String final_fruit_selection = "";
  86.  
  87. for(String Selection : selection)
  88. {
  89. final_fruit_selection = final_fruit_selection + Selection + "n";
  90.  
  91. }
  92. final_text.setText(final_fruit_selection);
  93. selection.clear();
  94.  
  95. final_text.setEnabled(true);
  96.  
  97. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement