Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activity or Fragment which is better way to use for performance and reliable? [duplicate]

I'm new to android and i have developing an android app that is starting now. It is kinds of saveable user input information with specific Date/Time. And reviewable previous stored data to user. And also store some setting information.

This may be look simple but it will cost a lot of UI components. I recently learned Activity and Fragment and preferred to use one Main Activity class and the rests are will build with Fragments.

My understanding is, Fragment is corporate with Activity Life cycle and intend to use as reusable for other Activities.

But the thing that i want to know is as i mentioned in question,

  1. Is that cost performance for using Activity per UI View ?
  2. If using with Fragment for UI View, it may be more good in performance but reliability (such as : manually maintaining data states while rotation with Activity and Fragment each other, but if used Activity it will more less custom maintenance) is more sure for using Fragment ?

I want some advice of my question.

like image 383
config Avatar asked Dec 11 '13 08:12

config


People also ask

Which is better fragments or activities?

Activities are an ideal place to put global elements around your app's user interface, such as a navigation drawer. Conversely, fragments are better suited to define and manage the UI of a single screen or portion of a screen.

Are fragments faster than activity?

Each tab will have a fragment to hold the products. The tabs could either held in activity or a fragment. I do find fragments a slightly faster than activities but really its not something you would really notice in most cases. Regardless if they was intended for speed or not they still seem/feel little quicker.

What is the advantage of using fragments?

Fragments allow such designs without the need for you to manage complex changes to the view hierarchy. By dividing the layout of an activity into fragments, you become able to modify the activity's appearance at runtime and preserve those changes in a back stack that's managed by the activity.


1 Answers

Check this :

Activities vs Fragments,

Activities vs Fragments and

Activities vs Fragments

Hope this helps.

like image 95
Siddharth_Vyas Avatar answered Oct 30 '22 08:10

Siddharth_Vyas