How not to use so many Activities?

2
Hello, I'm starting to program something on android a few days ago (a simple but extensive shell identification program, in it you have 5 options, within these 5 plus a few depending on the species, and inside more options until you reach in a specific shell with all the information of it), so I was creating layouts and activities for each species, class, etc ... I ended up giving some 200 layouts and activities and I have not yet reached the end of the kkkk program and only then I I thought "there's something wrong with that" hehe. So I would like to know if there is any other way to do such a program with options within options, totally offline, without using so many activities and layouts.

    
asked by anonymous 04.04.2017 / 13:12

1 answer

1

Dude, if I've got it right, you have a catalog with several shells, and you want to display them in a list where the user can select one and see the details, right? If so, you're going the wrong way doing an activity / fragment for each shell, think to me if you have a shell object, could not you do a fragment for the listing and one for the detail? This detail fragment would be generic and would display information for a shell object. Correct me if I did not get your idea, but if the idea is this: "View list and shell details" then you are in the wrong direction, if the idea is: "For each shell I want to create a certain different logic for example species X does a certain action, species Y does an action completely different from X ", yes you should create a fragment for each species. And if you do not know how to store those shells that is not fixed in a fragment gives one studied about the Android database. NO HARD CODE!

    
04.04.2017 / 14:19