1

I have a ListView that look at a list of my protobuf object. When the user click on an item in the ListView, I want to show the details of that object. Currently, I am implementing this as a separate activity. Before I start the activity, I need to pass in the object data.

Should I serialize my protobuf object and pass it in the child activity? The child activity will have to deserialize the protobuf object.

Or should I provide some kind of accessor for my child activity to modify private fields of the parent activity?

Reno
  • 33,594
  • 11
  • 89
  • 102
Dat Chu
  • 10,822
  • 13
  • 58
  • 82

1 Answers1

0

Should I serialize my protobuf object and pass it in the child activity? The child activity will have to deserialize the protobuf object.

Yeah this is the way to go, :) ... or you can use Parcelable. Another option is to extend the Application class and have it store the protobuf data. This data will be accessible in all of your Activities.

Or should I provide some kind of accessor for my child activity to modify private fields of the parent activity?

No this is a bad idea

Community
  • 1
  • 1
Reno
  • 33,594
  • 11
  • 89
  • 102