Difference between persistent and non-persistent data
Asked Answered
S

3

6

onPause() should be used to save persistent data and onSaveInstanceState(Bundle) is typically used to save non-persistent data.What does that mean?What is difference between persistent and non-persistent data?

Sizing answered 18/2, 2016 at 8:33 Comment(0)
A
10

Persistence data:
The data which is available after fully closing the application. This type of data must be save into shared preference or database or internal or external memory

Non- persistence data:
The data which is not available after fully closing the application. we can say that non - persistence data mean volatile data that available during the execution of the application.

Acridine answered 8/8, 2018 at 5:7 Comment(0)
C
7

Persistent data is data which you want to be available even after you fully close and restart your app.

The three most common ways to safe this data localy is by using SharedPreferences, a local database or the file system (store data as a file).

Android Developers offers a guide for this: http://developer.android.com/training/basics/data-storage/index.html

Cataplexy answered 18/2, 2016 at 8:38 Comment(0)
A
1

onPause() should be used to save persistent data

Commit data that is going to be used throughout the life of the application. For example data inside your database or shared preferences.

onSaveInstanceState(Bundle) is typically used to save non-persistent data

Commit data that is specific to the current view session. For example keeping track of the current state of the views on screen.

Andrea answered 18/2, 2016 at 8:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.