본문 바로가기
프로그래밍 놀이터/안드로이드, Java

[android] 연락처 이름과 전화번호로 list 만들기

by 돼지왕 왕돼지 2012. 11. 1.
반응형


연락처 이름과 전화번호로 list 만들기

Cursor cursor = managedQuery( Phone.CONTENT_URI, 
                                                   
new String[]{ Phone._ID, Phone.DISPLAY_NAME, Phone.DATA1 },
                                                   
null, 
                                                   
null,
                                                   Phone.
DISPLAY_NAME + " asc" );


SimpleCursorAdapter cursorAdapter =
 new SimpleCursorAdapter( this,
                                                                            android.R.layout.
simple_ist_item_2,
 
                                                                           cursor, 
                                                                            new String[]{ Phone.DISPLAY_NAME, Phone.DATA1 }, 
                                                                            new int[]{ android.R.id.text1, android.R.id.text2 } );


ListView listView = new ListView( this );
listView.setAdapter( cursorAdapter );
setContentsView( listView ); 






도움이 되셨다면 손가락 꾸욱~ ( 로그인 필요 x )






반응형

댓글