Android - How to create a Standard Fragment to be used / extend multiple Child Fragments?

0

Some of my application will have 12 tabs (fragments using viewpager and tabs adapter) showing a chart and a simple list. The 12 tabs will do the same thing, only what changes is the list and graphic information.

How can I apply this using inheritance or composition? And what is the correct way to deal with it? I wanted to use composition, but the Android system requires a default fragment builder.

What would even change would be just the data I get from a SQLite database through a loader. But the layout and the methods executed on all would be pretty much the same.

I'd like to do this, for the simple fact of having a cleaner and smarter implementation. If I found a bug in my code for example, would I ever have to redo 13 times? It would be much easier to deal with this using OO. So I'd like to know the right way and how to do it.

Thanks for any help.

    
asked by anonymous 24.06.2018 / 00:55

0 answers