K
K
Kren_vpravo2015-12-25 16:04:59
Android
Kren_vpravo, 2015-12-25 16:04:59

How often and how much do you use snippets?

I met projects where > 10 screens and one activity, all transitions - change of fragments.
I met the other way around, where fragments are used only on screens, where on a tablet they need to be combined into 1 screen.
Some for each task create an activity and a fragment in it (that is, all the content of an activity is in a fragment).
How are you doing? What are the pros and cons?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Peter, 2015-12-25
@petermzg

An Activity has methods that allow you to save and restore state.
That is, in the version with fragments, it will be necessary to restore fragments.
There are projects where only the main View changes to Activity.
It all depends on your task, use the method that will be more convenient and easier for you to implement the desired functionality.

R
Roman Artemov, 2016-01-12
@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.
Where exactly to use fragments, and where the activity as a whole depends on the task.

J
jinnerrer, 2016-01-16
@jinnerrer

A Fragment (Fragment class) represents a behavior or user interface part in an Activity (Activity class). A developer can combine multiple fragments into a single activity to build a multi-pane user interface and reuse a fragment across multiple activities. A fragment can be thought of as a modular part of an operation. Such a part has its own life cycle and independently handles input events. In addition, it can be added or removed directly during the operation. This is something like a nested operation that can be reused in different operations.

developer.android.com/intl/ru/guide/components/fra...
in my opinion, totally exhaustive

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question