1

I am creating an app that has a slide menu..When you choose different options of the slide menu, you can do the following:

  • Option 1: Upload a photo
  • Option 2: Check all the uploaded photos
  • Option 3: Check out all the nearby events

I am not sure if it is better to create a fragment that is created when an option is selected, or if an activity should be created if an option is selected..Please note, each option shows certain elements such as an autocomplete location box that are common to each other.

CUrrently I have created a Fragment with subfragments that are displayed as the user clicks on each option. In hindsight, I am not sure if having activities having fragments was a better option. Can someone tell me what's a better way in my case, and why?

a.ch.
  • 8,285
  • 5
  • 40
  • 53
gazubi
  • 561
  • 8
  • 32
  • It does not seem that you cases have too much in common to use resuseable fragments. I would use activities, and the autocomplete box you can have a reuseable layout to avoid replication of the layout. The actual function of it should be in a reuseable class anyway and not bound to the activity. – sprocket12 Jan 08 '14 at 10:31
  • i have a few other re-usable parts such as form components..So does it make sense to have fragments, and not activities? – gazubi Jan 08 '14 at 10:39
  • Creating or not creating a fragment is not a decision that is based on having re-useable components inside the fragment but of the fragment being re-useable as a whole. For example if you have a login box in many parts of your app it makes sense to use a fragment, but if you have a autocomplete textbox which is used as part of many activities then it should not be make into a fragment but instead the layout should be re-used, the code would be reuseable anyway as you would have it in your domain objects. – sprocket12 Jan 08 '14 at 13:43
  • look at this http://stackoverflow.com/questions/19927452/to-fragment-or-not-to-fragment-nested-fragments-against-activities-why-should it have a whole explanation to your question – Emmanuel T Dec 11 '14 at 19:04

0 Answers0