SimpleCursorAdapter
SimpleCursorAdapter는 커서를 XML 파일에 정의된 TextViews 혹은 ImageViews로 컬럼을 맵핑시키는 쉬운 어댑터이다. 당신은 어떤 컬럼을 원하는지 어떤 뷰에 컬럼을 보여주고 싶은지 명시할 수 있다. 그리고 이러한 뷰의 모습을 정의하는 XML파일은 두가지 형태로 바인딩된다. 첫째로 만약 SimpleCursorAdapter.ViewBinder가 가능하다면, setViewValue(android.view.View, android.database.Cursor, int)가 호출된다. 만약 리턴값이 참이면 바인딩이 실행된다. 만약 리턴값이 거짓이고 바인딩 되는 뷰는 TextView 라면 setViewText(TextView, String)가 호출된다. 만약 리턴 값이 거짓이고 바인딩되는 뷰가 ImageView라면 setViewImage(ImageView, String)이 호출된다. 만약 적절한 바인딩이 발견되지 않으면 IllegalStateException이 던져진다. 만약 이 어댑터가 필터링과 함께 사용되면 예를들어 AutoCompleteTextView와 같은 당신은 SimpleCursorAdapter.CursorToStringConverter와 FilterQueryProvider 인터페이스가 필터링프로세스를 컨트롤한다. 자세한 내용은 convertToString(adnroid.database.Cursor) 그리고 runQueryOnBackgroundThread(CharSequence)에 대해서 내용을 참조할 수 있다.
(원문)
An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. You can specify which columns you want, which views you want to display the columns, and the XML file that defines the appearance of these views. Binding occurs in two phases. First, if a SimpleCursorAdapter.ViewBinder
is available, setViewValue(android.view.View, android.database.Cursor, int)
is invoked. If the returned value is true, binding has occured. If the returned value is false and the view to bind is a TextView, setViewText(TextView, String)
is invoked. If the returned value is false and the view to bind is an ImageView,setViewImage(ImageView, String)
is invoked. If no appropriate binding can be found, an IllegalStateException
is thrown. If this adapter is used with filtering, for instance in an AutoCompleteTextView
, you can use the SimpleCursorAdapter.CursorToStringConverter
and the FilterQueryProvider
interfaces to get control over the filtering process. You can refer to convertToString(android.database.Cursor)
andrunQueryOnBackgroundThread(CharSequence)
for more information.
댓글 없음:
댓글 쓰기