E
E
EVGENY T.2018-08-01 16:25:41
Android
EVGENY T., 2018-08-01 16:25:41

Do a snippet every time?

I read the book "Android. Programming for professionals".
In chapter 7 I was overcome with doubts. The authors recommend that you always make fragments and shove them into activities, even if you can get by with one activity. They say - then it will be easier to do projects and not rush about.
In Chapter 8, the authors created an abstract activity that can load one fragment. And now they propose to build fragments and each time implement the activity from the abstract one, loading the desired fragment.
I look at it and think - isn't it too tricky? Is it justified to follow this application building pattern?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2018-08-01
@Beshere

As far as I remember, there is an explanation. That if you want to remake an activity using fragments, it will be more difficult than using fragments in the first place.
the key here is "if we want fragments".
If we just need a simple activity and we won’t touch it, then why bother. We need to make it easier.
In Blueprint
, pay attention to the difference between without the use of Fragments and with fragments
. Fragments were introduced to simplify the code (breaking a complex system into simple parts). The part that released the view interface in MVP was taken out into fragments. The rest remained active.
fragments became the implementation of Contract.View in MVP.
So the complexity is reduced.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question