I went to the YouTube Academy for Kotlin Android Development and created a semi complex app with Google FireBase, I have hit a roadblock in some code using an ExpandableListView that requires bindings.
After doing some research It seems that people use fragments instead of separate activities since like the past 10 years.
Should I convert all of my activities (besides main) to fragments?
Is there performance benefits?
How difficult is it to make this change?
Asked
Active
Viewed 42 times
0

Learning_slow
- 3
- 4
-
1If you want to. There's no performance benefits at all. There are some benefits, and some problems. But opinion topics like this are off topic here. – Gabe Sechan May 13 '22 at 03:10
-
surprisingly exactly what I wanted to hear, thank you. – Learning_slow May 13 '22 at 03:23
-
There are no really large changes in performance, just that activities use just a little more RAM and CPU than a fragment does. – ToxicFlame427 May 13 '22 at 03:24
1 Answers
0
Actually this is more about development benefits rather than performance benefits. Fragments and activities are not just about showing some screens.This is more. You can check this and this questions for some understandings why to use fragments. There is also a popular concept in modern android development called "Single Activity Architecture". Please read this and this articles for having a good understanding. I think you will get all your answers.

Khaled Saifullah
- 2,279
- 3
- 25
- 26
-
Thank you, I'll check those out. I read a bit about this Single Activity Architecture schema, It seems anytime you'll reuse a 'view' it should be a fragment. I guess I could circumvent the binding issue with manually grabbing the ID. I'm not sure how this affects the CustomExpandableListView class, but I'll work it out. Was concerned this app was going to be performance inefficient with solely activities but looks like we're good for now. – Learning_slow May 13 '22 at 23:44