ArrayAdapter의 항목으로 채워진 ListView가 있습니다. 이제 나는 클릭 할 때 그들을 치고 싶다. 또한 이미 공격 받았을 때 (외부 API 호출 등) 처음부터 체크하고 싶다. 하지만 위의 메서드는 onItemClickListener에서만 작동합니다. ListView getChildAt()는 null을 유지하지만 onclick에서 작동하면
public void machListe() {
listViewArrayAdapter = new ArrayAdapter(getApplicationContext(),R.layout.task_item, ti);
taskListe.setAdapter(listViewArrayAdapter);
TextView ab=(TextView) taskListe.getChildAt(0);
그래서 나는 Debugg 경우 지금은 AB가 null 볼 : 이 더 잘 이해하기 위해, 여기에 몇 가지 코드입니다.
taskListe.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {
TextView ab=(TextView) taskListe.getChildAt(0);
여기서 디버그하면 ab는 null이 아닙니다.
:-)하지만 성능이 좋지 않아서 조금만 빠르다 – Florian
문제는 지금은 항목이 표시 될 때마다보기를 업데이트하지만, 서버에서 데이터를로드하므로 유동적이지 않습니다! – Florian
하하 바보 같은 실수. 나는 그것을 서버에서 매번로드했는지 여부를 확인하기 위해로드했습니다.하지만이 배열을 이전에 저장 했으므로 쓸모없고 바보 같았습니다. 지금은 fluetnly now :-) – Florian