Tuesday, 15 April 2014

android - How can I avoid code duplication with Fragment callbacks to a details activity? -



android - How can I avoid code duplication with Fragment callbacks to a details activity? -

i'm using master/detail pattern 1 activity managing 2-pane view , selector list , other activity managing detail fragments. i'm using interface handle fragment callbacks activities.

there seems lot of code duplication though details activity copying many of callback methods 2-pane activity. appropriate, i've used static methods context isn't required, context required i'm not sure how remove code duplication neatly.

inheritance abstract parent activity alternative seems lot of overhead.

is there improve way of doing this?

i asked similar question here: how many activities vs fragments?

i worried duplication of logic, , answers got caused quite healthy debate.

in end chose follow stephen's answer, of putting much of logic fragments themselves.

however other contributors seemed keen on duplicating logic per examples.

android android-fragments code-duplication

No comments:

Post a Comment