2017-09-13 11 views
0

나는 실시간 데이터베이스 (firebase)를 변경할 때마다 listview에서 행을 강조 표시하려고합니다. 위치 "1"에서 뭔가를 바꿀 때 강조 표시가 정확하지만 다음은 바뀝니다. 위치 "2", positsions (1과 2) 두 개가 강조 표시됩니다. if 문에서 if (CharSequences가있는 현재 객체 필드를 비교하는 것보다) 오히려 잘못 생각합니다.ListView가 매번 새로 고침되는 android TextWatcher

public View getView(final int position, View convertView, final ViewGroup parent) {  
... 
... 
public void onTextChanged(CharSequence s, int start, int before, int count) { 
      if ((user.name.equals(s.toString())) == false) { 


       finalConvertView.setBackgroundColor(Color.GREEN); 
       new CountDownTimer(500, 100) { 

        public void onTick(long millisUntilFinished) { 

        } 

        public void onFinish() { 
         finalConvertView.setBackgroundColor(Color.WHITE); 

        } 
       }.start(); 

      } 

     } 

답변

0

나는 문 경우와 finalConvertView.setBackgroundColor(Color.GREEN);

사이 finalConvertView.setBackgroundColor(Color.WHITE);

를 추가하여이 문제를 해결