当前位置: 首页>>代码示例>>Java>>正文


Java ListAdapter.getItem方法代码示例

本文整理汇总了Java中android.widget.ListAdapter.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java ListAdapter.getItem方法的具体用法?Java ListAdapter.getItem怎么用?Java ListAdapter.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ListAdapter的用法示例。


在下文中一共展示了ListAdapter.getItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getItem

import android.widget.ListAdapter; //导入方法依赖的package包/类
/**
 * Get the data item associated with the specified
 * position in the data set.
 *
 * @param position Position of the item whose data we want
 */
@Override
public Object getItem(int position)
{
	for (ListAdapter piece : pieces)
	{
		int size = piece.getCount();

		if (position < size)
		{
			return (piece.getItem(position));
		}

		position -= size;
	}

	return (null);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:24,代码来源:MergeAdapter.java

示例2: onKeyDown

import android.widget.ListAdapter; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (isPopupShowing()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_COMMA:
                ListAdapter adapter = getAdapter();
                // There is at least one item in the dropdown list
                // when isPopupShowing() is true.
                Object selectedItem = adapter.getItem(0);
                replaceText(convertSelectionToString(selectedItem));
                dismissDropDown();
                return true;
        }
    }

    return super.onKeyDown(keyCode, event);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:18,代码来源:RecipientsEditor.java

示例3: getItem

import android.widget.ListAdapter; //导入方法依赖的package包/类
/**
 * Get the data item associated with the specified
 * position in the data set.
 *
 * @param position Position of the item whose data we want
 */
@Override
public Object getItem(int position) {
    for (ListAdapter piece : getPieces()) {
        int size = piece.getCount();

        if (position < size) {
            return (piece.getItem(position));
        }

        position -= size;
    }

    return (null);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:21,代码来源:MergeAdapter.java

示例4: updatePlayDonation

import android.widget.ListAdapter; //导入方法依赖的package包/类
public void updatePlayDonation(int total, boolean contributor) {
    Activity activity = getActivity();
    if (activity == null) {
        return;
    }
    BreventApplication application = (BreventApplication) activity.getApplication();
    String summary;
    double donation = BreventApplication.getDonation(application);
    String play = Integer.toString(total);
    String rmb = DecimalUtils.format(donation);
    if (contributor) {
        if (total > 0) {
            if (DecimalUtils.isPositive(donation)) {
                summary = getString(R.string.show_donation_play_and_rmb_and_contributor,
                        play, rmb);
            } else {
                summary = getString(R.string.show_donation_play_and_contributor, play);
            }
        } else {
            if (DecimalUtils.isPositive(donation)) {
                summary = getString(R.string.show_donation_rmb_and_contributor, rmb);
            } else {
                summary = getString(R.string.show_donation_contributor);
            }
        }

    } else {
        if (total > 0) {
            if (DecimalUtils.isPositive(donation)) {
                summary = getString(R.string.show_donation_play_and_rmb,
                        play, rmb);
            } else {
                summary = getString(R.string.show_donation_play, play);
            }
        } else {
            if (DecimalUtils.isPositive(donation)) {
                summary = getString(R.string.show_donation_rmb, rmb);
            } else if (getArguments().getBoolean(IS_PLAY, false)) {
                summary = getString(R.string.show_donation_summary_play);
            } else {
                summary = getString(R.string.show_donation_summary_not_play);
            }
        }
    }
    preferenceDonation.setSummary(summary);
    int count = total + DecimalUtils.intValue(donation);
    if (contributor) {
        count += BreventSettings.CONTRIBUTOR;
    }
    ListAdapter rootAdapter = getPreferenceScreen().getRootAdapter();
    int size = rootAdapter.getCount();
    for (int i = 0; i < size; ++i) {
        Object item = rootAdapter.getItem(i);
        if (item instanceof DonationPreference) {
            ((DonationPreference) item).updateDonated(count);
        }
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:59,代码来源:SettingsFragment.java


注:本文中的android.widget.ListAdapter.getItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。