Contents

조회 수 45242 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
777 Develop [ios] 최신 UI 모음.. (나중에 정리할 것) secret hooni 2013.08.09 0
776 Develop [ios] UI컨트롤러 샘플코드 hooni 2013.08.08 15425
775 Develop [ios] libxml/tree.h file not found file hooni 2013.08.08 18709
774 Develop [ios] 소소한 팁 (Rect,Point,Path,URL 등) hooni 2013.08.08 29457
773 Develop [ios] Background 에서 네트워크 사용 file hooni 2013.07.22 11510
772 Develop [ios] App States file hooni 2013.07.22 13195
771 Etc 영어의 12 시제 (The twelve tenses of English) hooni 2013.07.12 15702
770 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18798
769 Develop git 브런치 배우기 (링크) hooni 2013.07.09 20571
768 Develop GCM 사용하기 3 (JSP로 GCM 푸시 서버 만들기) 4 file hooni 2013.07.06 25316
767 Develop GCM 사용하기 2 (단말에 GCM 구현하기) file hooni 2013.07.06 23248
766 Develop [android] GCM 사용하기 1 (GCM 서비스 신청하기) file hooni 2013.07.06 51356
Board Pagination Prev 1 ... 29 30 31 32 33 34 35 36 37 38 ... 98 Next
/ 98