Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public class MainActivity extends Activity implements OnClickListener{
  2.  
  3. Boolean a = false;
  4. Boolean b = false;
  5. Boolean c = false;
  6.  
  7. Button buttonA;
  8. Button buttonB;
  9. Button buttonC;
  10.  
  11. @Override
  12. protected void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.activity_main);
  15.  
  16. buttonA = (Button)findViewById(R.id.button_a);
  17. buttonB = (Button)findViewById(R.id.button_b);
  18. buttonC = (Button)findViewById(R.id.button_c);
  19.  
  20. buttonA.setOnClickListener(this);
  21. buttonB.setOnClickListener(this);
  22. buttonC.setOnClickListener(this);
  23.  
  24. }
  25. @Override
  26. public void onClick(View v) {
  27. Button button;
  28. button = (Button)v;
  29.  
  30. if(button == buttonA) a = true;
  31. if(button == buttonB) b = true;
  32. if(button == buttonC) c = true;
  33.  
  34. if(a && b && c)
  35. sendButton();
  36. }
  37.  
  38. private void sendButton(){
  39. //3つのボタンが押された時にやりたい処理
  40.  
  41. a = false;
  42. b = false;
  43. c = false;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement