在 getView() 方法中我想调用 getIntent()。我怎样才能在不开始新活动的情况下实现这一目标。 getView方法是这样的
public View getView(final int position, View convertView, ViewGroup parent) {
PaymentData rowItem = getItem(position);
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = mInflater.inflate(
com.android.paypal.homeactivity.R.layout.list_item, null);
holder = new ViewHolder();
holder.radioBtn = (RadioButton) convertView
.findViewById(com.android.paypal.homeactivity.R.id.rdb_payment_method);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
if (position == getCount() - 1 && userSelected == false) {
holder.radioBtn.setChecked(true);
mCurrentlyCheckedRB = holder.radioBtn;
} else {
holder.radioBtn.setChecked(false);
}
holder.radioBtn.setText(rowItem.getRdbText());
return convertView;
}
这是这个问题的解决方案。
Intent intent = ((Activity) context).getIntent();
intent.putExtra("SELECTED_PAYMENT", mCurrentlyCheckedRB
.getText().toString());
((Activity) context).setResult(((Activity) context).RESULT_OK,
intent);
((Activity) context).finish();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)