當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleCursorAdapter.getCursor方法代碼示例

本文整理匯總了Java中android.widget.SimpleCursorAdapter.getCursor方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleCursorAdapter.getCursor方法的具體用法?Java SimpleCursorAdapter.getCursor怎麽用?Java SimpleCursorAdapter.getCursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.SimpleCursorAdapter的用法示例。


在下文中一共展示了SimpleCursorAdapter.getCursor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:27,代碼來源:AccountTransactionListFragment.java

示例2: 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);
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:27,代碼來源:WatchlistFragment.java

示例3: onItemLongClick

import android.widget.SimpleCursorAdapter; //導入方法依賴的package包/類
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
{
	try
	{
		isLongClick = true;
		
		SimpleCursorAdapter simpleCursorAdapter = (SimpleCursorAdapter) arg0.getAdapter();
		
		Cursor cursor = simpleCursorAdapter.getCursor();
		cursor.moveToPosition(arg2);
		
		int cursorIndex1 = cursor.getColumnIndex(CONTACT_FILTER.NUMBER);
		int cursorIndex2 = cursor.getColumnIndex(CONTACT_FILTER.RECORDABLE);
		
		final String number = cursor.getString(cursorIndex1);
		final int recordable = cursor.getInt(cursorIndex2);
		
		LayoutInflater layoutInflater = LayoutInflater.from(Filters.this);
		View dialogview = layoutInflater.inflate(R.layout.filter_dialog_detail, null);
		
		AlertDialog.Builder builder = new AlertDialog.Builder(Filters.this);
		
		builder.setTitle(number);
		
		builder.setView(dialogview);
		
		TextView numberTextview = (TextView) dialogview.findViewById(R.id.filter_dialog_detail_number);
		Button acquitButton = (Button) dialogview.findViewById(R.id.filter_dialog_detail_acquit);
		
		if(recordable == 0)
		{
			numberTextview.setText(getApplicationContext().getString(R.string.filter_dialog_detail_number_0));
		}
		else
		{
			numberTextview.setText(getApplicationContext().getString(R.string.filter_dialog_detail_number_1));
		}
		
		final Dialog alertDialog;
		alertDialog = builder.create();
		alertDialog.show();
		themeManager.setAlertDialog(getApplicationContext(), alertDialog);
		
		acquitButton.setOnClickListener(new View.OnClickListener()
		{
			@Override
			public void onClick(View v)
			{
				alertDialog.dismiss();
			}
			
		});

		isLongClick = false;

		return true;
	}
	catch (Exception e)
	{

		return false;
	}
}
 
開發者ID:vassela,項目名稱:AC2RD,代碼行數:65,代碼來源:Filters.java


注:本文中的android.widget.SimpleCursorAdapter.getCursor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。