im new with android studio and im having trouble on how can I pass some specific data/s from one arraylist to another arraylist. Im currently working on with an ordering system. Iam trying to add the specific data (Name, Price & Qty) from my Arraylist to my Arraylist if Qty > 0.
Edited: ProductList
public class product_List extends ListFragment{
ArrayList<product> productList;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
productList = new ArrayList<product>;
productList.add(new product("Pasta 1", $10.00, 0(this is for Quantity), R.drawable.pastaIcon1));
}
}
OrderList
public class order_List extends ListFragment {
ArrayList<order> orderList;
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
orderList = new ArrayList<order>;
// HERE I want to add the product/s if its quantity > 0
}
}
I have a separate class for the product.class(string, double, int, int) and order.class(string, double, int). I also have an arrayAdapter for productlist that has buttons that will increment/decrement the quantity of the product.