I know this is an old question, but since I'm here :)
In any case, what I am doing is to pass the identifier of the element I want, and then use the application to store my data.
For example, let's say I have a class called Order, each order has many rows (s), something like this
class Order { UUID _id; List<Line> _lines = new ArrayList<>(); } class Line { UUID _id; Product _product ; BigDecimal _price; int _quantity; }
and etc.
So, I have an implementation of the application where I store all my (in memory) orders, like this:
public class App extends Application { public static final List<Order> Orders = new Order(); public static final Order GetOrder(UUID id) { for (Order o : Orders) { If(o.get_id().Equals(id)) return o; } return null; } }
Then, if I want to convey a specific order, I do something like this:
Intent i = new Intent(this, OrderEdit.class); i.putExtra(OrderEdit.ID, my_order.get_id().ToString()); startActivity(i);
and on the other hand:
UUID id = UUID.fromString(getArguments().getExtra(ID)); App.GetOrder(id);
that way you always have a link.
source share