D
D
Deno952016-04-15 00:51:31
Android
Deno95, 2016-04-15 00:51:31

When should you create activities and when should you use fragments?

When should you create activities and when should you use fragments?
Application example:
I will have a map with location definitions, before that I want to make a loading screen while the map is immersed. After the address is determined, there will be a button for placing an order (there will be a form for this). Then it will be possible to see where the car with orders is moving. There will also be a registration window if the user is not registered.
How to organize all this correctly? What principle of building a window should be?
Advise how to organize it correctly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Artemov, 2016-04-15
@roman_art

I use fragments as a standalone component that can be reused in different parts of the application. So to say it turns out code reuse. If you need to reuse some components, it is still better to make it a fragment.

K
Kanesy, 2016-04-21
@kanesy

I don’t remember where I came across this approach: the activity is the base for any action (creating a new user, for example), and all the fragments that are based in it are responsible for this action. On the other hand, I had to use a separate activity for the Collapsing Toolbar. fragment did not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question