2

Is there any limitation in using of fragments in app? Can huge number of fragment s affect on performance of app?

Edit: I want to play movie with 5 minutes duration at most.

Samin Heydarian
  • 101
  • 1
  • 7

4 Answers4

2

Is there any limitation in using of fragments in app?

There is no limit

Can huge number of fragment affects on performance of app?

Yes, it surely can, reasons

  • Memory allocations
  • Cpu consuptions
  • Lifecycle manager (activity and fragment both)

Possible Solution

  • Enable large heap in manifest's application tag

    android:largeHeap="true"

  • Use findFragmentByTag instead of creating fragments
  • Use back stack
Pavneet_Singh
  • 36,884
  • 5
  • 53
  • 68
0

Is there any limitation in using of fragments in app?

No, there is no limit in adding fragments in Android development.

Can huge number of fragment affects on performance of app?

its depend on What operation you will perform in fragments

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0

Using Fragments is dependent on App's functionality. It's Developer's Choisce to use Fragment's or not. If your app contains various different options and you needed to use Navigation Drawer, TabView or any Swipable view then in such condition using Fragment will be more suitable.

Adding and Replacing Fragment in your app should done in correct manner and as per need. If it then it will not affect the performance of your app and there is no such limitation on certain number of using Fragments. You can add it as per your need.

Hope it helps.

Jaimin Modi
  • 1,530
  • 4
  • 20
  • 72
0

You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities.

The Fragment performing is important to get a good performance. Should handle right way like memory(cache,addBackStack,etc.,)

https://developer.android.com/guide/components/fragments#Transactions

Manivash
  • 48
  • 6