mDataList = new ArrayList<String>();
mButton[0] = (Button) findViewById(R.id.numButton1);
mButton[1] = (Button) findViewById(R.id.numButton2);
mButton[2] = (Button) findViewById(R.id.numButton3);
mButton[3] = (Button) findViewById(R.id.numButton4);
mButton[4] = (Button) findViewById(R.id.numButton5);
mButton[5] = (Button) findViewById(R.id.numButton6);
mButton[6] = (Button) findViewById(R.id.numButton7);
mButton[7] = (Button) findViewById(R.id.numButton8);
mButton[8] = (Button) findViewById(R.id.numButton9);
mButton[9] = (Button) findViewById(R.id.numButton10);
mButton[10] = (Button) findViewById(R.id.numButton11);
mButton[11] = (Button) findViewById(R.id.numButton12);
mButton[12] = (Button) findViewById(R.id.numButton13);
mButton[13] = (Button) findViewById(R.id.numButton14);
mButton[14] = (Button) findViewById(R.id.numButton15);
mButton[15] = (Button) findViewById(R.id.numButton16);
mButton[16] = (Button) findViewById(R.id.numButton17);
mButton[17] = (Button) findViewById(R.id.numButton18);
mButton[18] = (Button) findViewById(R.id.numButton19);
mButton[19] = (Button) findViewById(R.id.numButton20);
// 버튼들에 대한 클릭리스너 등록 및 각 버튼이 클릭되었을 때 출력될 메시지 생성(리스트)
for(int i = 0 ; i < 20 ; i++)
{
mButton[i].setFocusable(false);
mButton[i].setOnClickListener(this); // 클릭 리스너 등록
}
public void onClick(View v){ // 버튼 클릭 이벤트
final Button newButton = (Button) v;
if(newButton.isFocused() == false)
{
newButton.setBackgroundResource(R.drawable.btn2);
newButton.setFocusable(true);
}
final Button orderButton = (Button)findViewById(R.id.button1);
orderButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
newButton.setText(phoneAddress());
}
});
}
20개의 버튼을 만들어 버튼 클릭시
활성화를 한 후에 이벤트 처리를 하고 있습니다.
다른 버튼을 클릭하게 되면 이전에 활성화된 버튼을 false 하고싶은데
클릭하는 순간 newButton 이 바뀌게되어
어떤 버튼을 비활성화 해야할지 모르겠습니다.ㅠ