当前位置: 首页>>代码示例>>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;未经允许,请勿转载。