亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

目錄 搜尋
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
文字


CursorAdapter

翻譯時(shí)間:2011-1-20

版本:Android 2.3 r1

結(jié)構(gòu)

繼承關(guān)系

public abstract class CusrorAdapter extends BaseAdpater implements Filterable

?

java.lang.Object

android.widget.BaseAdapter

???????? android.widget.CursorAdapter

?

子類及間接子類

直接子類

???????? ResourceCursorAdapter

間接子類

SimpleCursorAdapter

?

類概述

通過該類可用Cursor的方式訪問數(shù)據(jù)庫,并將查詢出來的數(shù)據(jù)展示到列表視圖(ListView)部件上。其中游標(biāo)攜帶的結(jié)果集中必須有列名為“_id”的列,否則這個(gè)類無法工作。

?

構(gòu)造函數(shù)

public CusorAdapter(Context context,Cursor c)???

???????? 構(gòu)造函數(shù)。每當(dāng)數(shù)據(jù)庫的數(shù)據(jù)發(fā)生改變時(shí),適配器將調(diào)用requery()重新查詢以顯示最新的數(shù)據(jù)。

?????????????????? 參數(shù)

???????? context??? ??? 應(yīng)用程序上下文。

c????????????????????????? 用來獲取數(shù)據(jù)的游標(biāo)(Coursor)

?

public CusorAdapter(Context context,Cursor c, boolean autoRequery)???????

構(gòu)造函數(shù)。每當(dāng)數(shù)據(jù)庫的數(shù)據(jù)發(fā)生改變時(shí),適配器將調(diào)用requery()重新查詢以顯示最新的數(shù)據(jù)。

?????????????????? 參數(shù)

???????? context??? ??? 應(yīng)用程序上下文。

c????????????????????????? 用來獲取數(shù)據(jù)的Coursor

??????????????????????????? autoRequry ??? 設(shè)置為true時(shí),每當(dāng)數(shù)據(jù)庫的數(shù)據(jù)發(fā)生改變時(shí),適配器將調(diào)用requery()重新查詢以顯示最新的數(shù)據(jù)。

?

公共方法

public abstract void bindView (View view, Context context, Cursor cursor)

重用一個(gè)已有的view,使其顯示當(dāng)前cursor所指向的數(shù)據(jù)。

參數(shù)

??????????????????????????? view? ?????????????? 已存在的視圖, 返回之前newView方法創(chuàng)建的視圖。

??????????????????????????? context? ???????? 應(yīng)用程序上下文

??????????????????????????? cursor ????????????? 用于獲取數(shù)據(jù)的Coursor。Coursor已經(jīng)移到正確的位置。

????????

public void changeCursor (Cursor cursor)

???????? 更改底層的游標(biāo)為新傳入的游標(biāo)。如果游標(biāo)已經(jīng)存在則先關(guān)閉這個(gè)已存在的游標(biāo)。

參數(shù)??????????????????

??????????????????????????? cursor ????????????? Cursor。

?

public CharSequence convertToString (Cursor cursor)

???????? cursor轉(zhuǎn)換成CharSequence。子類應(yīng)該重寫這個(gè)方法并轉(zhuǎn)換它們的結(jié)果。這個(gè)方法的默認(rèn)實(shí)現(xiàn)是:當(dāng)cursor為空時(shí)返回一個(gè)空串,否則直接返回調(diào)用cursortoString()方法。

參數(shù)????????

??????????????????????????? cursor ????????????? cursor轉(zhuǎn)換成CharSequence對(duì)象。

???????? 返回值

?????????????????? 返回表示CharSequence的值。

?

public int getCount ()

???????? (譯者注:獲取適配器中數(shù)據(jù)的總行數(shù)。)

?????????????????? 參見

??????????????????????????? getCount()

?

public Cursor getCursor ()

???????? 返回當(dāng)前適配器綁定的Cursor對(duì)象。

返回值

???????? Cursor對(duì)象。

?

public View getDropDownView (int position, View convertView, ViewGroup parent)

獲取下拉列表選項(xiàng)指定位置的視圖對(duì)象

參數(shù)

???????? position? ????????????????? 視圖(View)對(duì)象的行索引。

???????? convertView? ????? 重用已有的視圖(View)對(duì)象。備注:在使用前你應(yīng)該檢查????????????????????????????????????????????????????????????? 一下這個(gè)視圖對(duì)象是否非空并且這個(gè)對(duì)象的類型是否合適??????????????????????????????????????????????????????? 。由此引伸出,如果該對(duì)象不能被轉(zhuǎn)換并顯示正確的數(shù)據(jù),?????????????????????????????????????????????????? 這個(gè)方法內(nèi)部就會(huì)重新創(chuàng)建一個(gè)合適的視圖(View)對(duì)象。

???????? parent???????????????????????? 不管是轉(zhuǎn)換后的還是重新創(chuàng)建的視圖(View)對(duì)象,始終都會(huì)依附于parent對(duì)象上。

返回值????

??????????????????????????? 返回視圖(View)對(duì)象,該對(duì)象顯示數(shù)據(jù)集指定位置上的數(shù)據(jù)。

?

public Filter getFilter ()

返回一個(gè)可以通過一種過濾模式來約束數(shù)據(jù)的過濾器。

這個(gè)方法通常在Adapter類實(shí)現(xiàn)。

返回值

??????????????????????????? 一個(gè)用于約束數(shù)據(jù)的過濾器

?

public FilterQueryProvider getFilterQueryProvider ()

返回一個(gè)提供過濾的查詢過濾器。若過濾器為null,則不再過濾。

返回值

??????????????????????????? 返回當(dāng)前過濾器對(duì)象,如果不存在返回null。

?????????????????? 參見

?????????????????? setFilterQueryProvider(android.widget.FilterQueryProvider)

?????????????????? runQueryOnBackgroundThread(CharSequence)

?

public Object getItem (int position)

(譯者注:獲取數(shù)據(jù)集中指定位置上的數(shù)據(jù)項(xiàng)目)

?????????????????? 參見

??????????????????????????? getItem(int)

?

public long getItemId (int position)

???????? (譯者注:獲取數(shù)據(jù)集中的指定位置上的行id。)

?????????????????? 參見

??????????????????????????? getItemId(int)

?

public View getView (int position, View convertView, ViewGroup parent)

(譯者注:獲取一個(gè)顯示數(shù)據(jù)集中指定位置數(shù)據(jù)段視圖。可以手動(dòng)創(chuàng)建視圖,或者從XML設(shè)計(jì)文件填充。當(dāng)視圖從XML設(shè)計(jì)文件填充時(shí),父視圖(如GridView,ListView等)將接受默認(rèn)的設(shè)計(jì)參數(shù),除非使用inflate(int, android.view.ViewGroup, boolean)去指定一個(gè)根視圖和防止依附于根視圖。)

???????? 參見

?????????????????? getView(int, View, ViewGroup)

?

public boolean hasStableIds ()

無論項(xiàng)ID代表的基礎(chǔ)數(shù)據(jù)的是否變化都保持不變。

返回值

如果為TRUE,意味著相同的ID始終引用相同的對(duì)象。

?

public View newDropDownView (Context context, Cursor cursor, ViewGroup parent)

生成一個(gè)新的下拉視圖來保存cursor指向的數(shù)據(jù)

???????? 參數(shù)

?????????????????? context ?應(yīng)用程序全局信息接口(應(yīng)用上下文)

cursor? ?獲取數(shù)據(jù)的游標(biāo),它已經(jīng)移動(dòng)到正確的位置

parent? 與新視圖相關(guān)聯(lián)的上級(jí)視圖

返回值

新創(chuàng)建的視圖。

?

public abstract View newView (Context context, Cursor cursor, ViewGroup parent)

新建一個(gè)視圖來保存cursor指向的數(shù)據(jù)

???????? 參數(shù)

?????????????????? context ?應(yīng)用程序全局信息接口(應(yīng)用上下文)

cursor? ?獲取數(shù)據(jù)的游標(biāo),它已經(jīng)移動(dòng)到正確的位置

parent? 與新視圖相關(guān)聯(lián)的上級(jí)視圖

返回值

??????????????????????????? 新創(chuàng)建的視圖。

?

public Cursor runQueryOnBackgroundThread (CharSequence constraint)

執(zhí)行含指定約束的查詢。此查詢依賴于適配器的過濾器。查詢是由FilterQueryProvider提供。如果沒有指定FilterQueryProvider,當(dāng)前cursor不過濾只返回。該方法會(huì)通過changeCursor(Cursor)方法返回一個(gè)Cursor對(duì)象,并且關(guān)閉掉先前的Cursor對(duì)象。這個(gè)方法始終在后臺(tái)線程執(zhí)行,而不是在應(yīng)用程序的主線程(或是UI線程)中運(yùn)行。規(guī)定:當(dāng)參數(shù)constraintnull或?yàn)榭諘r(shí),該方法返回原始結(jié)果。

???????? 參數(shù)

?????????????????? constraint? 該查詢必須被過濾的約束。

返回值

返回含有新的查詢結(jié)果的Cursor

參考

???????? getFilter()

getFilterQueryProvider()

?????????????????? setFilterQueryProvider(android.widget.FilterQueryProvider)

?

public void setFilterQueryProvider (FilterQueryProvider filterQueryProvider)

設(shè)置一個(gè)過濾器,用來過濾當(dāng)前的Cursor對(duì)象。當(dāng)這個(gè)適配器需要進(jìn)行過濾操作時(shí), runQuery(CharSequence)方法被調(diào)用。

???????? 參數(shù)

filterQueryProvider ?過濾器對(duì)象,設(shè)置為null時(shí),就相當(dāng)于移除了該過濾器。

?????????????????? 參考

??????????????????????????? getFilterQueryProvider()

runQueryOnBackgroundThread(CharSequence)

?

受保護(hù)方法

protected void init (Context context, Cursor c, boolean autoRequery)

(譯者注:供構(gòu)造函數(shù)使用初始化相關(guān)參數(shù))

?

protected void onContentChanged ()

當(dāng)cursor對(duì)象上的ContentObserver接收到改變的通知時(shí)就會(huì)調(diào)用該方法,其默認(rèn)實(shí)現(xiàn)提供了自動(dòng)重新查詢方式,但可以被子類重寫。

?

補(bǔ)充

?????? 文章精選

?????????????????? android CursorAdapter的監(jiān)聽事件

?????????????????? 實(shí)現(xiàn)基于Android的英文電子詞典


上一篇: 下一篇: