Efficiency of Parcelable vs Reading from the database

I have a fragment that lists "Semesters" as follows: it accesses the database, generates an array, which is then converted to views through ListAdapter.
In this fragment there is an add button that opens a new action in which the user can create a new semester, which is also inserted into the database in the same action.

After creating the semester, I obviously would like to show it when the user returns to the list.
For this, I have 2 options:

  • Send the created semester back as an object to the fragment. The problem is that I need to implement the interface Parcelableon most of my classes, because they are nested, which would be very tiring.
  • Make the list re-read the semester from the database and recreate the view from scratch.

My question is: which way would be faster and more efficient? Databases can get a lot of overtime, but the same goes for package objects, especially when they are nested, and there are Listcustom objects, etc., which makes this solution much more critical.

+4
source share
1 answer

. , , , .

, . (, 100 , ), onStart onRestart. . , .

(, Parcelable), , .

+5

All Articles