gpt4 book ai didi

android - 如何在适配器类中调用 getIntent()

转载 作者:太空狗 更新时间:2023-10-29 15:30:47 27 4
gpt4 key购买 nike

在 getView() 方法中,我想调用 getIntent()。在不开始新 Activity 的情况下如何实现这一目标。像这样的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();

关于android - 如何在适配器类中调用 getIntent(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16142773/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com