本文整理汇总了Java中android.widget.SimpleCursorAdapter.getCount方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleCursorAdapter.getCount方法的具体用法?Java SimpleCursorAdapter.getCount怎么用?Java SimpleCursorAdapter.getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SimpleCursorAdapter
的用法示例。
在下文中一共展示了SimpleCursorAdapter.getCount方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemViewType
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int getItemViewType(int position) {
int type = 1;
for (Object section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return TYPE_SECTION_HEADER;
if (position < size)
return type + adapter.getItemViewType(position - 1);
// otherwise jump into next section
position -= size;
type += adapter.getViewTypeCount();
}
return -1;
}
示例2: getItem
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object getItem(int position) {
for (String section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return section;
if (position < size)
return adapter.getItem(position - 1);
// otherwise jump into next section
position -= size;
}
return null;
}
示例3: getItemId
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public long getItemId(int position) {
for (String section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return 0;
if (position < size)
return adapter.getItemId(position - 1);
// otherwise jump into next section
position -= size;
}
return 0;
}
示例4: getView
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int sectionnum = 0;
for (Object section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return maps.getView(sectionnum, convertView, parent);
if (position < size)
return adapter.getView(position - 1, convertView, parent);
// otherwise jump into next section
position -= size;
sectionnum++;
}
return null;
}
示例5: selectCurrentAccount
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* Select the current account in the accounts dropdown.
*/
private void selectCurrentAccount() {
Spinner spinner = getAccountsSpinner();
if (spinner == null) return;
// find account
SimpleCursorAdapter adapter = (SimpleCursorAdapter) spinner.getAdapter();
if (adapter == null) return;
Cursor cursor = adapter.getCursor();
int position = Constants.NOT_SET;
for (int i = 0; i < adapter.getCount(); i++) {
cursor.moveToPosition(i);
String accountIdString = cursor.getString(cursor.getColumnIndex(Account.ACCOUNTID));
int accountId = Integer.parseInt(accountIdString);
if (accountId == mAccountId) {
position = i;
break;
}
}
spinner.setSelection(position);
}
示例6: selectCurrentAccount
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* Select the current account in the accounts dropdown.
*/
private void selectCurrentAccount() {
Spinner spinner = getAccountsSpinner();
if (spinner == null) return;
// find account
SimpleCursorAdapter adapter = (SimpleCursorAdapter) spinner.getAdapter();
if (adapter == null) return;
Cursor cursor = adapter.getCursor();
int position = Constants.NOT_SET;
for (int i = 0; i < adapter.getCount(); i++) {
cursor.moveToPosition(i);
String accountIdString = cursor.getString(cursor.getColumnIndex(Account.ACCOUNTID));
int accountId = Integer.parseInt(accountIdString);
if (accountId == getAccountId()) {
position = i;
break;
}
}
spinner.setSelection(position);
}
示例7: getItemViewType
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int getItemViewType(int position) {
int type = 1;
for (Object section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return TYPE_SECTION_HEADER;
if (position < size)
return type + adapter.getItemViewType(position - 1);
// otherwise jump into next section
position -= size;
type += adapter.getViewTypeCount();
}
return -1;
}
示例8: getItem
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object getItem(int position) {
for (String section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return section;
if (position < size)
return adapter.getItem(position - 1);
// otherwise jump into next section
position -= size;
}
return null;
}
示例9: getItemId
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public long getItemId(int position) {
for (String section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return 0;
if (position < size)
return adapter.getItemId(position - 1);
// otherwise jump into next section
position -= size;
}
return 0;
}
示例10: getView
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int sectionnum = 0;
for (Object section : this.sections.keySet()) {
SimpleCursorAdapter adapter = sections.get(section);
int size = adapter.getCount() + 1;
// check if position inside this section
if (position == 0)
return maps.getView(sectionnum, convertView, parent);
if (position < size)
return adapter.getView(position - 1, convertView, parent);
// otherwise jump into next section
position -= size;
sectionnum++;
}
return null;
}
示例11: onLoadFinished
import android.widget.SimpleCursorAdapter; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
String[] adapterCols = {TrucksOwnedByUserQuery.PROJECTION[TrucksOwnedByUserQuery.NAME]};
int[] adapterRowViews = new int[]{android.R.id.text1};
spinnerAdapter = new SimpleCursorAdapter(getSupportActionBar().getThemedContext(),
android.R.layout.simple_spinner_item, cursor, adapterCols, adapterRowViews, 0);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
actionBarSpinner.setAdapter(spinnerAdapter);
if (spinnerAdapter.getCount() > 0) {
actionBarSpinner.setSelection(0, true);
}
}