本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
}