我想在Upgrades
上执行更新,当我在Item
上单击某些ListView
时,它会被更新,但随后我必须回到另一个{{1} }。当我将Activity
改回以前的版本时,在更新之前会看到Activity
。
我的自定义Items
Adapter
处理点击事件,执行public class UpgradeAdapter extends ArrayAdapter<Upgrade> {
private List<Upgrade> upgrades;
public UpgradeAdapter(Context context, List<Upgrade> upgrades) {
super(context,0,upgrades);
this.upgrades = upgrades;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Upgrade upgrade = getItem(position);
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).
inflate(R.layout.product_list_layout, parent, false);
}
TextView name = convertView.findViewById(R.id.nameTextField);
TextView lvl = convertView.findViewById(R.id.lvlTextField);
TextView modifier = convertView.findViewById(R.id.modifierTextField);
TextView type = convertView.findViewById(R.id.typeTextField);
TextView cost = convertView.findViewById(R.id.costTextField);
name.setText(upgrade.getName());
lvl.setText(upgrade.getLvl() + "");
modifier.setText(upgrade.getModifier() + "");
type.setText(upgrade.getType().toString());
cost.setText(upgrade.getCost() + "");
return convertView;
}
}
notifyDataSetChanged()