0
MergeAdapter를 사용하여 섹션 헤더가있는 목록을 표시합니다. 이 목록은 잘 표시되지만 때로는 안되는 경우 getView 메소드 내부의 특정 사항이 트리거되는 경우가 있습니다.MergeAdapter 잘못된 시간에 특정 문장 실행
여기에 트리거가 발생했습니다.
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
...
try {
JSONObject thisRow = items.get(position);
...
View.OnClickListener myListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), ID, Toast.LENGTH_SHORT).show();
}
};
JSONObject alterations = thisRow.getJSONArray("alteration").getJSONObject(0);
// This if statement gets trigger when it shouldn't
if (!alterations.getString("text").equals("false")) {
CharSequence currText = time.getText();
time.setText(currText+" vs" +ID);
Log.d("FUApp", "Alterations 'text' isn't false at "+ID);
Button alter = (Button) centreView.findViewById(R.id.is_alt);
String s = String.valueOf(position);
alter.setText(s);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
alter.setLayoutParams(lp);
alter.setOnClickListener(myListener);
}
...
return centreView;
}
위치 값을 표시하는 레이블을 설정하고 여기에 내 앱에서 화면 캡처를 설정합니다.
버튼이 위치 (43) 인 표시되는 버튼이 전혀 표시되지 않아야 볼 수 있듯이.
나는 왜 이런 일이 일어나고 있는지 완전히 이해하기가 어렵습니다. 아무도 내가 이것을 알아낼 수있게 도와 줄 수 있습니까?
EDIT : 위치 (예 : 35)에서보기를 떠날 때 화면에 들어가는 행에서 if 문이 트리거되는 것으로 보입니다. 아직 어떻게 멈추는 지 아직 확실하지 않습니다.