lundi 15 août 2016

data management in fragment

I am currently working on an app, which has basically a navigagion drawer with some menu items and a frame. For every menu item, I want to change the fragment in the frame, which works fine.

But for example two fragments are displaying an image generated from a downloaded pdf file. Both use the same data fetchig system but different file urls. There is also a fragment which displays also an image from an pdf, but it gets its data from a complety other source.

My idea is to use a complex model of abstract classes and interface to reduce duplicate code.

But I don't know which programming patter I should use. The main problem is the connection between somekind of provider with a fragment. No non-default constructor and bundle limitations force me to use something else but I do not know what.

Thank you for helping.

Aucun commentaire:

Enregistrer un commentaire