Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends Activity implements OnClickListener{
- Boolean a = false;
- Boolean b = false;
- Boolean c = false;
- Button buttonA;
- Button buttonB;
- Button buttonC;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- buttonA = (Button)findViewById(R.id.button_a);
- buttonB = (Button)findViewById(R.id.button_b);
- buttonC = (Button)findViewById(R.id.button_c);
- buttonA.setOnClickListener(this);
- buttonB.setOnClickListener(this);
- buttonC.setOnClickListener(this);
- }
- @Override
- public void onClick(View v) {
- Button button;
- button = (Button)v;
- if(button == buttonA) a = true;
- if(button == buttonB) b = true;
- if(button == buttonC) c = true;
- if(a && b && c)
- sendButton();
- }
- private void sendButton(){
- //3つのボタンが押された時にやりたい処理
- a = false;
- b = false;
- c = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement