Hi!
I am writing an app. In one of the requirements, I have 2 activities which are almost identical in the content and layout. Almost 90% of them are identical. The rest of the 10% requires only changing the text labels and content which comes from a backend server.
Instead of have 2 activities and 2 layouts which are almost the same, I have 1 activity and 1 layout and based on a criteria, I have an "if else" statement to change those labels and content of the layout file in the activity.
To further reduce code redundancy and in future if I need to add more content to it, which design pattern should I use for this scenario?
I am reading up on the decorator pattern but if you could advise a more accurate pattern, I would be most thankful.
I am writing an app. In one of the requirements, I have 2 activities which are almost identical in the content and layout. Almost 90% of them are identical. The rest of the 10% requires only changing the text labels and content which comes from a backend server.
Instead of have 2 activities and 2 layouts which are almost the same, I have 1 activity and 1 layout and based on a criteria, I have an "if else" statement to change those labels and content of the layout file in the activity.
To further reduce code redundancy and in future if I need to add more content to it, which design pattern should I use for this scenario?
I am reading up on the decorator pattern but if you could advise a more accurate pattern, I would be most thankful.