I'm creating an app for pizzerias in my city and I'd like to know if you can send data from a ListActivity that contains pizzas to another ListActivity so that pizzas can be added to the list of favorites.
How can I do this?
I'm creating an app for pizzerias in my city and I'd like to know if you can send data from a ListActivity that contains pizzas to another ListActivity so that pizzas can be added to the list of favorites.
How can I do this?
There are some ways to "talk" between Activities, to simply send some information to another activity, you can use the Bundle as follows:
Bundle bundle = new Bundle();
bundle.putString("nomeCliente", cliente.getNome(position));
Intent intent = new Intent(context, MinhaOutraActivity.class);
intent.putExtras(bundle);
startActivity(intent);
Now, if you need to create a bookmark system, you need to save this information in the Database or preference file. You can see how to do this here:
How to use SharedPreferences in Android to store, fetch and edit values
Only one fix is putExtra as below:
Bundle bundle = new Bundle();
bundle.putString("nomeCliente", cliente.getNome(position));
Intent intent = new Intent(context, MinhaOutraActivity.class);
intent.putExtra(bundle);
startActivity(intent);