I have an activity
from which I created a dialog passing a list of objects
.
In the dialog, I have modified the global object list
data.
Problem is my activity object list
is also modified from the dialog data manipulation. I didn't use any listener or method to do caller class data. AFAIK these are a separate object and doesn't have the same reference, So it shouldn't have changed.
Activity caller section:
ProductQuantityReviewDialog dialog = new ProductQuantityReviewDialog(context, salesOrderList);
dialog.show();
Dialog class :
private HashMap<Integer, OrderSalesModel> salesOrderList;
public ProductQuantityReviewDialog(@NonNull Context context, HashMap<Integer, OrderSalesModel> salesOrderList) {
super(context);
this.context = context;
this.salesOrderList = salesOrderList;
}
Update: Tried in this way but same problem.
public ProductQuantityReviewDialog(@NonNull Context context, HashMap<Integer, OrderSalesModel> salesOrderList) {
super(context);
this.context = context;
orderList = new HashMap<>(salesOrderList);
// orderList.putAll(salesOrderList);
}