Contents

조회 수 45246 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

ArrayAdapter 샘플 코드

public class ArrayAdapterTest2 extends ListActivity {
    ArrayList<String> aList = new ArrayList<String>();

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        for(int i=0; i<100; i++){
            aList.add("haha"+i);
        }

        ArrayAdapter<String> aA =
            new ArrayAdapter<String>(this, R.layout.list_item, aList);
        
        setListAdapter(aA);

        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() { 
            public void onItemClick(AdapterView<?> parent, View view, 
            int position, long id) { 
              // When clicked, show a toast with the TextView text 
              Toast.makeText(getApplicationContext(),
                  ((TextView) view).getText(), Toast.LENGTH_SHORT).show(); 
            } 
        }); 
    }
}


?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
633 Develop [c] UCP/TCP 채팅 소스 - 정리해야 함.. file hooni 2003.04.23 7917
632 Develop [chm] C++ 문법 가이드 file hooni 2013.04.23 7944
631 Develop [c] 마우스 따라다니는 고양이 - 네코95 (WinAPI) file hooni 2013.04.23 7947
630 Develop [js] 양원님이 공유해 주신 유료(5$란다ㅋ) 자료 ㅋㅋ secret hooni 2013.04.23 7948
629 Develop [c++] 트리컨트롤 스텝 3 예제.. file hooni 2013.04.23 7951
628 Develop [c++] Win32API를 이용한 ExitWindowsEx 사용한 예제코드 hooni 2013.04.23 7967
627 Develop [c] 퀵정렬(quick sort) 예제 소스.. file hooni 2013.04.23 7980
626 Develop [doc] Equation Solving에 대한 발표자료.. file hooni 2013.04.23 7981
625 Develop [c] 문자열 처리 관련 함수들 설명 hooni 2003.04.23 7997
624 Develop [c] 자료구조 그래프(graph) 소스코드 - 확인해볼 것.. file hooni 2013.04.23 7997
623 Develop 논문에 들어갈 툴바 테스트 해볼 것.. secret hooni 2013.04.23 8013
622 Develop [java] RGB코드를 HEX코드로 변환하는 코드 ㅎㅎ hooni 2013.04.23 8016
Board Pagination Prev 1 ... 41 42 43 44 45 46 47 48 49 50 ... 98 Next
/ 98