List of usage examples for android.widget SimpleCursorAdapter getCount
public int getCount()
From source file:com.money.manager.ex.investment.watchlist.WatchlistFragment.java
/** * Select the current account in the accounts dropdown. *///from ww w . jav a 2s .co m 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); }
From source file:com.money.manager.ex.account.AccountTransactionListFragment.java
/** * Select the current account in the accounts dropdown. *///w w w . j av a 2s . c om 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); }