I am trying to pass some data to another activity, but I need pass the data when I click in a button , but not start the new activity and when i have multiple past data, launch the new activity and see all the content that I have passed before.
The process is similar to a shopping cart, add products and then another activity you see the list of the cart.
I have been trying with SharePrerences, but I only pass one data.
final SharedPreferences mSettings = this.getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = mSettings.edit();
editor.putString(NOMBRE_TAG, tvNotas.getText().toString());
editor.putString(PRECIO_TAG, pantalla.getText()+"");
editor.commit();
with putExtra I do not think it works, because I dont know how much data I will pass
Intent intent = new Intent(this, NAME.class);
intent.putextra("SOMETHING","value");
startActivity(intent);
String data = getIntent().getExtras().getString("SOMETHING");
And i dont know other forms to do it.
The process is similar like