When to use a Fragment instead of an Activity

0

I'm working on a project where I'm making use of several fragments and only a activity . Given a search, I saw that many places suggest using fragments when the code will be reused, so I wondered where to use fragments and where it would be more interesting to use activities .

The flow of my project goes like this;

Tela de login > Tela de lista > tela de inserção de item na lista
                              > tela de visualização de item da lista
                              > tela de itens removidos da lista > tela de visualização de itens removidos da lista
                              > tela de relatórios

I do not know if the flowchart is clear, at the moment I am without any program to do something more appropriate. In my case, there is only activity in all these screens, and of these only the view screens are reused (even fragment ). All others are fragments which, although used constantly, are not reused .

My question is: where in this scenario is it better to use activities instead of fragments ?

    
asked by anonymous 01.12.2014 / 16:25

1 answer

1

It is considered good practice to use activity in case of a single flow, for example, let's say that inside the editing screen of the item you put the option of the user to select an icon for that item, the flow that you would do after that would be a unique path (the user could select images that you added in the application or select an image from the gallery). This selection screen is only accessible from the item added screen in the list, not being reused by any other. Another important point is that you do not want during the icon selection the user goes to the list of items already created or to the reports, you want the user to finish selecting the item or cancel the operation (you do not need to stay saving the state of it once it has completed what it is doing.)

    
01.12.2014 / 21:48