I am programming an App in which I want that by pressing a button I send variables to an Activity but without opening the next activity, since it is like a sales cart type where the products are acomulated.
I want the activity to open when the user wants.
Thanks
public void pancakes(View v){
control+=1;
pedido.setText(control+"");
Toast t = Toast.makeText(getApplicationContext(),"Producto agregado", Toast.LENGTH_SHORT);
t.show();
String nombre = "Pancakes";
double precio=60.00;
}
This is the code of my button, I define it with onClick, and the last two variables (name, price) are what I want to send to the activity but if I open it.
And so I have several buttons and what I want is to accumulate the information and then show it in another activity