architecture-samples icon indicating copy to clipboard operation
architecture-samples copied to clipboard

What is the need for a fragment

Open shangeethsivan opened this issue 6 years ago • 3 comments

Branch - todo-mvp

I can't understand the use of a fragment here. The only use it see is that it is used to separate the view and the activity.

Should I always create a fragment to separate the view even if Im not needing a fragment.

https://github.com/googlesamples/android-architecture/tree/todo-mvp/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/taskdetail

shangeethsivan avatar Jul 05 '18 07:07 shangeethsivan

when i add a fragment then it can't be compiled,

zung avatar Jul 11 '18 07:07 zung

@florina-muntenescu any thoughts on the above question

shangeethsivan avatar Feb 27 '19 07:02 shangeethsivan

when i add a fragment then it can't be compiled,

Branch - todo-mvp

I can't understand the use of a fragment here. The only use it see is that it is used to separate the view and the activity.

Should I always create a fragment to separate the view even if Im not needing a fragment.

https://github.com/googlesamples/android-architecture/tree/todo-mvp/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/taskdetail

Though the idea of using an activity seems easy but creating a fragment is much better in long term , because fragments can be removed and resused multiple places. Hope it helps

Akashsri3bi avatar Sep 20 '21 18:09 Akashsri3bi