I come from the web world, I'm new to Android.
In the web world, you usually pass the id of things, from the "list view" to the "detail view", example:
URL: Messages/List --> Message/Detail?messageId=x
In Android, I have this activity with all my messages: MessagesActivity
They are fetched from the db (SQLite) and displayed in a ListView with a custom made Adapter.
Question: Is it inefficient to only pass the id of the message (in the intent extras) from this activity to MessageDetailActivity
?
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Intent intent = new Intent(thisActivityContext, MessageDetailActivity.class);
intent.putExtra("messageId", id); // inefficient? should pass object?
startActivity(intent);
}
As opposed to passing the entire message object. I'm asking this because I'm not finding very intuitive the usage of a "Tag" in my view, that I would have to cast...
Also, holding all the "Message" objects in tags would use a lot of memory maybe