當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。