本文整理匯總了Java中android.support.v4.widget.SimpleCursorAdapter.notifyDataSetChanged方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleCursorAdapter.notifyDataSetChanged方法的具體用法?Java SimpleCursorAdapter.notifyDataSetChanged怎麽用?Java SimpleCursorAdapter.notifyDataSetChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.widget.SimpleCursorAdapter
的用法示例。
在下文中一共展示了SimpleCursorAdapter.notifyDataSetChanged方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: populateList
import android.support.v4.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
private void populateList() {
String[] from = null;
if (isFav) {
from = new String[] { Beans.Favorite.COL_TITLE };
} else {
from = new String[] { Beans.Category.COL_NAME };
} //check if fav or list
int[] to = { R.id.list_item_text };
int layoutId = R.layout.list_item;
if (Preferences.getInstance(getActivity()).isRTL())
layoutId = R.layout.list_item_right;
getLoaderManager().initLoader(1, null, this);
adapter = new SimpleCursorAdapter(getActivity(), layoutId, null, from,
to, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
adapter.setViewBinder(new Binder());
setListAdapter(adapter);
adapter.notifyDataSetChanged();
}
示例2: applySuggestionCursor
import android.support.v4.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
/**
* Set the suggestion cursor to an Adapter then set it to the search view
*/
private void applySuggestionCursor() {
final String[] cols = { COLUMN_NAME_ADDRESS};
final int[] to = {R.id.suggestion_item_address};
final SimpleCursorAdapter mSuggestionAdapter = new SimpleCursorAdapter(getActivity().getApplicationContext(),
R.layout.search_suggestion_item, mSuggestionCursor, cols, to, 0);
mSearchview.setSuggestionsAdapter(mSuggestionAdapter);
mSuggestionAdapter.notifyDataSetChanged();
}
示例3: prepareSearchSuggestions
import android.support.v4.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
@Override
public void prepareSearchSuggestions(List<DrawerItemCategory> navigation) {
final String[] from = new String[]{"categories"};
final int[] to = new int[]{android.R.id.text1};
searchSuggestionsAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1,
null, from, to, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
if (navigation != null && !navigation.isEmpty()) {
for (int i = 0; i < navigation.size(); i++) {
if (!searchSuggestionsList.contains(navigation.get(i).getName())) {
searchSuggestionsList.add(navigation.get(i).getName());
}
if (navigation.get(i).hasChildren()) {
for (int j = 0; j < navigation.get(i).getChildren().size(); j++) {
if (!searchSuggestionsList.contains(navigation.get(i).getChildren().get(j).getName())) {
searchSuggestionsList.add(navigation.get(i).getChildren().get(j).getName());
}
}
}
}
searchSuggestionsAdapter.notifyDataSetChanged();
} else {
Timber.e("Search suggestions loading failed.");
searchSuggestionsAdapter = null;
}
}
示例4: setupAdapter
import android.support.v4.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
private void setupAdapter(){
final int views[] = { R.id.listing_title, R.id.listing_address, R.id.listing_city };
final Cursor cursor;
String[] fields;
if (mIsSearchQuery) {
fields = new String[]{ SearchTable.COLUMN_NAME, SearchTable.COLUMN_STREET, SearchTable.COLUMN_CITY };
cursor = getActivity().getContentResolver().query(YellowContentProvider.CONTENT_URI_SEARCH_LISTINGS, SearchTableHelper.searchTableAdapterProjection, null, null, null);
} else {
fields = new String[]{ ListingsTable.COLUMN_NAME, ListingsTable.COLUMN_STREET, ListingsTable.COLUMN_CITY };
cursor = getActivity().getContentResolver().query(YellowContentProvider.CONTENT_URI_LISTINGS, ListingsTableHelper.listingsTableAdapterProjection, null, null, null);
}
SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), R.layout.row_listview, cursor, fields, views, 0);
mListView.setAdapter(adapter);
adapter.notifyDataSetChanged();
}
示例5: populateList
import android.support.v4.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
public void populateList() {
String[] from = new String[] { DBAdapter.KEEP_TABLE.COL_DATA, DBAdapter.KEEP_TABLE.COL_COLOR };
int[] to = new int[] { R.id.textView1, R.id.item_color};
getLoaderManager().initLoader(1, null, this);
adapter = new SimpleCursorAdapter(getActivity(), R.layout.keep_item, null, from, to,
CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
adapter.setViewBinder(new Binder());
setListAdapter(adapter);
adapter.notifyDataSetChanged();
}