List - > details flow. Best practices Android

109 Views Asked by At

I was wondering, what are the best practices or preferred way to handle with list and details flow in Android.

Example:

a) I have fragment A with a list of items.

b) When user select an item, I will show item details in another screen (Activity or fragment, for this question purpose this doesn't matter).

All my data are stored into database, using Content Provider.

Question:

Should I get just an item id in fragment A, pass as extra to screen B and select entire data using a cursor loader in screen B

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    // Launch intent with id param.
}

Or select entire data in fragment A and pass as extra to screen B?

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    // TODO get selected item.
    Parking parking = (Parking) parent.getAdapter().getItem(position);

    // Launch intent with parking as extra.
}

Best practices?

0

There are 0 best solutions below