亚洲国产日韩欧美一区二区三区,精品亚洲国产成人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
テキスト

CursorTreeAdapter

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

版本:Android 3.0 r1

結(jié)構(gòu)

繼承關(guān)系

public abstract class CusrorTreeAdapter

???????? extends BaseExpandableListAdpater implements Filterable

?

java.lang.Object

android.widget.BaseExpandableListAdapter

???????? android.widget.CursorTreeAdapter

?

子類(lèi)及間接子類(lèi)

直接子類(lèi)

???????? ResourceCursorTreeAdapter

間接子類(lèi)

SimpleCursorTreeAdapter

?

類(lèi)概述

通過(guò)該適配類(lèi)可以用一連續(xù)的游標(biāo)(Coursor)對(duì)象訪(fǎng)問(wèn)數(shù)據(jù)庫(kù),并將查詢(xún)出來(lái)的數(shù)據(jù)展示到可伸縮的列表視圖(ExpandableListView)部件上。頂層游標(biāo)(Cursor)對(duì)象(在構(gòu)造器中指定)顯示全部組,后面的游標(biāo)(Cursor)對(duì)象從getChildrenCursor(Cursor)獲取并展示子元素組。其中游標(biāo)攜帶的結(jié)果集中必須有個(gè)名為“_id”的列,否則這個(gè)類(lèi)不起任何作用。

?

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

public CursorTreeAdapter (Cursor cursor, Context context)

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

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

cursor?????? 為組(groups)提供數(shù)據(jù)的游標(biāo)(Coursor)

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

?

public CursorTreeAdapter (Cursor cursor, Context context, boolean autoRequery)

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

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

cursor?????? 為組(groups)提供數(shù)據(jù)的游標(biāo)(Coursor)

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

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

?

公共方法

public void changeCursor (Cursor cursor)

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

參數(shù)

??????????????????????????? cursor ????????????? 新游標(biāo)(Cursor)對(duì)象。

?

public CharSequence convertToString (Cursor cursor)

cursor轉(zhuǎn)換成CharSequence。子類(lèi)應(yīng)該重寫(xiě)這個(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類(lèi)型的值(譯者注:這個(gè)值是通過(guò)轉(zhuǎn)換參數(shù)cursor類(lèi)型而獲得的。)

?

public Cursor getChild (int groupPosition, int childPosition)

???????? 獲取指定組中的指定子元素的相關(guān)數(shù)據(jù)。

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

??????????????????????????? groupPosition? 組位置(該組內(nèi)部含有子元素)

?????????????????? ???????? childPosition??? 子元素位置(相對(duì)于其它子元素)

???????? ???????? 返回值

??????????????????????????? 返回指定子元素?cái)?shù)據(jù)。

?

public long getChildId (int groupPosition, int childPosition)

獲取指定組中的指定子元素ID,這個(gè)ID在組里一定是唯一的。聯(lián)合ID(參見(jiàn)getCombinedChildId(long, long))在所有條目(所有組和所有元素)中也是唯一的。

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

??????????????????????????? groupPosition? 組位置(該組內(nèi)部含有子元素)

?????????????????? ???????? childPosition??? 子元素位置(相對(duì)于其它子元素)

?????????????????? 返回值

???????? ???????? 子元素關(guān)聯(lián)ID。

?

???????? public View getChildView (int groupPosition, int childPosition, boolean isLastChild, ? View convertView, ViewGroup parent)

獲取一個(gè)視圖對(duì)象,顯示指定組中的指定子元素?cái)?shù)據(jù)。

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

?????????????????? ???????? groupPosition? 組位置(該組內(nèi)部含有子元素)

?????????????????? ???????? childPosition?? 子元素位置(決定返回哪個(gè)視圖)

?????????????????? ???????? isLastChild??? 子元素是否處于組中的最后一個(gè)

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

?????????????????? ???????? parent? ?????????? 返回的視圖(View)對(duì)象始終依附于的視圖組。

???????? ???????? 返回值

?????????????????? ???????? 指定位置上的子元素返回的視圖對(duì)象

?

public int getChildrenCount (int groupPosition)

???????? 獲取指定組中的子元素個(gè)數(shù)

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

??????????????????????????? groupPosition? 組位置(決定返回哪個(gè)組的子元素個(gè)數(shù))

?????????????????? 返回值

??????????????????????????? 返回組中的子元素個(gè)數(shù)

?

public Cursor getCursor ()

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

返回值

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

?

public Filter getFilter ()

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

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

返回值

??????????????????????????? 返回一個(gè)用來(lái)限制數(shù)據(jù)的過(guò)濾器(Filter)對(duì)象。

?

public FilterQueryProvider getFilterQueryProvider ()

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

返回值

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

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

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

?

public Cursor getGroup (int groupPosition)

獲取指定組中的數(shù)據(jù)

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

??????????????????????????? groupPosition? 組位置

?????????????????? 返回值

???????? ?????????????????? 返回組中的數(shù)據(jù),也就是該組中的子元素?cái)?shù)據(jù)。

?

public int getGroupCount ()

???????? 獲取組的個(gè)數(shù)

?????????????????? 返回值

???????? ???????? ???????? 組的個(gè)數(shù)

?

public long getGroupId (int groupPosition)

???????? 獲取指定組的ID,這個(gè)組ID必須是唯一的。聯(lián)合ID(參見(jiàn)getCombinedGroupId(long))在所有條目(所有組和所有元素)中也是唯一的。

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

??????????????????????????? groupPosition? 組位置

?????????????????? 返回值

??????????????????????????? 返回組ID

?

public View getGroupView (int groupPosition, boolean isExpanded, View ????????? convertView, ViewGroup parent)

???????? 獲取顯示指定組的視圖對(duì)象。這個(gè)方法僅返回關(guān)于組的視圖對(duì)象,要想獲取子元素的視圖對(duì)象,就需要調(diào)用getChildView(int, int, boolean, View, ViewGroup)

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

?????????????????? groupPosition? 組位置(決定返回哪個(gè)視圖)

?????????????????? isExpanded? ? ?該組是展開(kāi)狀態(tài)還是伸縮狀態(tài)

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

?????????????????? parent? ?????????? 返回的視圖對(duì)象始終依附于的視圖組。

???????? 返回值

?????????????????? 返回指定組的視圖對(duì)象

?

???????? public boolean hasStableIds ()

???????? 組和子元素是否持有穩(wěn)定的ID,也就是底層數(shù)據(jù)的改變不會(huì)影響到它們。

???????? 返回值

??????????????????????????? 返回一個(gè)Boolean類(lèi)型的值,如果為TRUE,意味著相同的ID永遠(yuǎn)引用相同的對(duì)象。

?

???????? public boolean isChildSelectable (int groupPosition, int childPosition)

???????? 是否選中指定位置上的子元素。

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

??????????????????????????? groupPosition? 組位置(該組內(nèi)部含有子元素)

??????????????????????????? childPosition? ?子元素位置

?????????????????? 返回值

???????? ???????? 是否選中子元素

?

???????? public void notifyDataSetChanged (boolean releaseCursors)

???????? 通知數(shù)據(jù)集已改變,該方法還為任何帶有緩存功能的游標(biāo)提供不用釋放資源的可選功能。

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

???????? ???????? releaseCursors? 是否釋放任何帶有緩沖功能的游標(biāo)資源

?

???????? public void notifyDataSetChanged ()

???????? 該方法內(nèi)部實(shí)現(xiàn)了在每個(gè)觀察者上面調(diào)用onChanged事件。每當(dāng)發(fā)現(xiàn)數(shù)據(jù)集有改變的情況,或者讀取到數(shù)據(jù)的新?tīng)顟B(tài)時(shí),就會(huì)調(diào)用此方法。

?

???????? public void notifyDataSetInvalidated ()

???????? 該方法內(nèi)部實(shí)現(xiàn)了在每個(gè)觀察者上面調(diào)用onInvalidated事件。每當(dāng)發(fā)現(xiàn)數(shù)據(jù)集監(jiān)控有改變的情況,比如該數(shù)據(jù)集不再有效,就會(huì)調(diào)用此方法。

?

???????? public void onGroupCollapsed (int groupPosition)

???????? 當(dāng)指定組收縮狀態(tài)的時(shí)候調(diào)用此方法。

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

??????????????????????????? groupPosition? 指定組收縮狀態(tài)

?

public Cursor runQueryOnBackgroundThread (CharSequence constraint)

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

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

?????????????????? constraint? 當(dāng)某個(gè)查詢(xún)需要過(guò)濾功能,使用參數(shù)constraint作為約束條件。

返回值

??????????????????????????? 返回含有新的查詢(xún)結(jié)果的Cursor。

參考

???????? getFilter()

getFilterQueryProvider()

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

?

???????? public void setChildrenCursor (int groupPosition, Cursor childrenCursor)

???????? 為指定組子元素設(shè)置游標(biāo)(Cursor),并關(guān)閉已存在的游標(biāo)。這個(gè)方法是非常有用的,當(dāng)進(jìn)行異步查詢(xún)操作的時(shí)候用來(lái)避免UI發(fā)生阻塞的情況。

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

?????????????????? groupPosition? ?組位置(組中的哪個(gè)子元素要設(shè)置游標(biāo)對(duì)象)

???????? ?????????????????? childrenCursor? 組子元素的游標(biāo)(Cursor)

?

???????? public void setFilterQueryProvider (FilterQueryProvider filterQueryProvider)

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

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

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

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

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

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

?

???????? public void setGroupCursor (Cursor cursor)

???????? 設(shè)置組游標(biāo)對(duì)象。

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

???????? ???????? ???????? cursor? 設(shè)置組游標(biāo)對(duì)象,并關(guān)閉已存在的游標(biāo)對(duì)象。

?

受保護(hù)方法

???????? protected abstract void bindChildView (View view, Context context, Cursor cursor, ???????? boolean isLastChild)

???????? 用游標(biāo)(Coursor)的方式將子元素?cái)?shù)據(jù)綁定在一個(gè)已存在的視圖(View)對(duì)象上。

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

??????????????????????????? view? ???? ??????? 已存在的視圖(View)對(duì)象, 也就是之前new出來(lái)的。

??????????????????????????? context? ???????? 應(yīng)用程序上下文對(duì)象

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

??????????????????????????? IsLastChild? ??子元素是否處于組中的最后一個(gè)

?

???????? protected abstract void bindGroupView (View view, Context context, Cursor cursor, ????? boolean isExpanded)

???????? 用游標(biāo)(Coursor)的方式將組數(shù)據(jù)綁定在一個(gè)已存在的視圖(View)對(duì)象上。

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

??????????????????????????? view? ???? ??????? 已存在的組視圖(View)對(duì)象, 也就是早先new出來(lái)的。

??????????????????????????? context? ???????? 應(yīng)用程序上下文對(duì)象,它已經(jīng)移動(dòng)到正確的位置

??????????????????????????? cursor? ?????????? 獲取數(shù)據(jù)的游標(biāo)對(duì)象

??????????????????????????? isExpanded?? 該組是展開(kāi)狀態(tài)還是伸縮狀態(tài)

?

???????? protected abstract Cursor getChildrenCursor (Cursor groupCursor)

???????? 獲取指定組中的子元素游標(biāo)對(duì)象。子類(lèi)必須實(shí)現(xiàn)這個(gè)方法,用于在指定組中返回子元素?cái)?shù)據(jù)。

如果你想用異步查詢(xún)的方式避免UI阻塞的情況發(fā)生,可能會(huì)返回null或是在稍后調(diào)用setChildrenCursor(int, Cursor)。

你有責(zé)任在Activity生命周期中管理這個(gè)游標(biāo)對(duì)象,有一個(gè)非常好的思路:使用managedQuery(Uri, String[], String, String[], String)來(lái)管理它們。在某些情況下,適配器本身會(huì)使游標(biāo)停止工作,但這個(gè)特例不會(huì)總是出現(xiàn),所以我們要確保有效地管理好游標(biāo)對(duì)象。

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

??????????????????????????? groupCursor? 組游標(biāo)對(duì)象,決定返回哪個(gè)組中的子元素游標(biāo)對(duì)象。

?????????????????? 返回值

??????????????????????????? 返回指定組中的子元素游標(biāo)對(duì)象或者為null。

?

???????? protected abstract View newChildView (Context context, Cursor cursor, boolean ??? isLastChild, ViewGroup parent)

???????? 創(chuàng)建一個(gè)新的子元素視圖并持有指向數(shù)據(jù)的游標(biāo)cursor。

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

??????????????????????????? context? ???????? 應(yīng)用程序上下文對(duì)象

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

??????????????????????????? IsLastChild? ?子元素是否處于組中的最后一個(gè)

??????????????????????????? parent? ????新視圖(View)所依附于的父對(duì)象。

?

???????? protected abstract View newGroupView (Context context, Cursor cursor, boolean isExpanded, ViewGroup parent)

???????? 創(chuàng)建一個(gè)新的組視圖并持有組中指向數(shù)據(jù)的游標(biāo)cursor

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

??????????????????????????? context? ???????? 應(yīng)用程序上下文對(duì)象

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

??????????????????????????? isExpanded?? 該組是否展開(kāi)狀態(tài)

??????????????????????????? parent? ?????新視圖(View)所依附于的父對(duì)象。

?

補(bǔ)充

???????? 文章精選

?????????????????? 說(shuō)說(shuō)定制自己的CursorAdapter

?


前の記事: 次の記事: