我在一个活动中使用了RecyclerView。在Adaptater中我修改了一个ArrayList的内容。我如何在我的第一个活动中检索我修改过的ArrayList?非常感谢您的帮助。向Georges致以最诚挚的问候
holder.imageClick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (laPlateaux.get(position).Cat.equals("U7")) {
keyPlateau = "PlatU7" + "-" + zdte + "-" + laPlateaux.get(position).AccueilNum;}
else {
keyPlateau = "PlatU9" + "-" + zdte + "-" + laPlateaux.get(position).AccueilNum; }
if (laPlateaux.get(position).Cat.equals("U7")) {
if (laPlateaux.get(position).Select.equals("N")){
mDatabase.child("PlateauxU7").child(keyPlateau).child("Selected").setValue("Y");
holder.imageClick.setImageDrawable(holder.itemView.getContext().getDrawable(R.drawable.valoknew));
laPlateaux.get(position).Select = "Y";
notifyDataSetChanged();}
else {
mDatabase.child("PlateauxU7").child(keyPlateau).child("Selected").setValue("N");
holder.imageClick.setImageDrawable(holder.itemView.getContext().getDrawable(R.drawable.valnoknew));
laPlateaux.get(position).Select = "N";
notifyDataSetChanged();}}
else {
if (laPlateaux.get(position).Select.equals("N")){
mDatabase.child("PlateauxU9").child(keyPlateau).child("Selected").setValue("Y");
holder.imageClick.setImageDrawable(holder.itemView.getContext().getDrawable(R.drawable.valoknew));
laPlateaux.get(position).Select = "Y";
notifyDataSetChanged();}
else {
mDatabase.child("PlateauxU9").child(keyPlateau).child("Selected").setValue("N");
holder.imageClick.setImageDrawable(holder.itemView.getContext().getDrawable(R.drawable.valnoknew));
laPlateaux.get(position).Select = "N";
notifyDataSetChanged();}}} }); }
@Override
public int getItemCount() {
return laPlateaux.size();
}
1条答案
按热度按时间uqcuzwp81#
我猜您必须在适配器中实现公共getter,仅此而已。
在适配器中
在活动中