4
나는 EditText를 포함하는 ListView를 가지고있다. 이 텍스트 상자의 textchanged 이벤트를 캡처하고 다른 열을 업데이트하려고합니다. 내 customAdapter 내부안드로이드에서 Listview 안에서 TextChanged 이벤트 캡쳐하기
나는 사용자가 아무것도 변경되지 않은 경우에도 이벤트 자체에 해고되고이
public View getView(int position, View inView, ViewGroup parent) {
View v = inView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.cartlistview, null);
}
EditText edQty = (EditText) v.findViewById(R.id.cartProductQuantity);
edQty.addTextChangedListener(new QtyChangedWatcher(position, v));
}
했다. 또한 사용자가 첫 번째 행에 대해서만 입력을 변경하면 이벤트가 시작되지만 목록보기의 모든 텍스트 상자에 대해 발생합니다.
내가 잘못 했나요?
public View getView(int position, View inView, ViewGroup parent) {
View v = inView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.cartlistview, null);
EditText edQty = (EditText) v.findViewById(R.id.cartProductQuantity);
edQty.addTextChangedListener(new QtyChangedWatcher(position, v));
}
}
합니다 (만약 조건 내부에 addTextChangedListener 이동)
이 EditText' 객체에 포커스가'중 하나를 할 때'Activity' 생성합니까 :
감사 – teoREtik
내가 한 일이 옳은지 나는 확신하지 못한다. 내 짝수 코드에서는 이전 값과 이후 값을 검사하고, 값이 다르면 코드로 진행했습니다. 텍스트 상자에 setTag 함수를 사용하여 이전 값을 저장했습니다. – Arun