I have created a shopping cart in Android, the user has the option to see a product in a ListView, then clicking on it goes to an activity where he sees the product detail and has the option to confirm the purchase, until now all right but I want to give the option to continue buying and until the end confirm the whole purchase, here is where I do not know what is the best option if you save each order temporarily in the BD or if there is another way to temporarily save the order and go adding more products. I had thought about creating an ArrayList but every time I enter the activity detail that Array is restarted.
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),codigo,Toast.LENGTH_LONG).show();
pedido.add(codigo);
}
})