문자열 배열에서 테이블을 동적으로 채 웁니다. 테이블의 각 행에도 한 열의 값을 늘리거나 줄이기위한 더하기 및 빼기 단추가 있습니다. 이 버튼은 아래 코드와 같이 동적으로 생성됩니다. 클릭하면 정확한 버튼을 어떻게 감지 할 수 있습니까? 즉; 두 번째 행의 '+'버튼을 클릭하면 추가 처리를 위해 클릭 한 버튼의 ID를 어떻게 얻을 수 있습니까?동적으로 생성 된 테이블에서 클릭 한 버튼을 식별하는 방법
plusButton= new Button(this);
minusButton= new Button(this);
createView(tr, tv1, names[i]);
createView(tr, tv2, (String)(names[i+1]));
minusButton.setId(i);
minusButton.setText("-");
minusButton.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
plusButton.setId(i);
plusButton.setText("+");
plusButton.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));`
이벤트 핸들러를 연결하면됩니다. – IamStalker