Pass list to another Activity

Asked

Viewed 302 times

1

I am creating an app, at this point in the app, you choose how many products you will get from a Recyclerview List and this list will be passed to another Activity where it will be loaded in a Listview.

I wanted to know what I can use to store the user-clicked products.
I was thinking of using sharedPreference, but each product has various information, such as description, id, value... and if it is more than one product, how can I get this information separately? Hashmap usage? List?

  • Use Sqlite.....

  • I am using Firebase to store, think it is the best way to use Sqlite?

  • If you will save multiple products, sqlite would be more viable, but if you will store only 1 product, it may be sharedpreference itself.

  • But it is that so, the products are already being stored in Firebase, wanted a way to work both for a product and for more, without using the Sqlite, will there be some way?

1 answer

2


If you just want to pass the selected items to another Activity, store them in one ArrayList<Produto>.

Place this array in Intent with intent.putExtra().

The class Product has to implement the Serializable or Parcelable interface.
See how in How to use a Bundle with a non-reprimitive type?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.