Saving Data on Android


Thread  or  InputStream



Download 19,28 Mb.
Pdf ko'rish
bet41/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   37   38   39   40   41   42   43   44   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Thread
 or 
InputStream
. The Serialization process implies the 
use of 
reflection
.
Reflection is the ability for an object to know things about itself. Therefore, using 
serializable can result in a lot of garbage collection which then translates to poor 
performance and battery drain. Fortunately, there’s another way to marshal objects 
in Android.
Parcelable
Parcelable
, like Serializable, is an interface. However, unlike Serializable, Parcelable 
is part of the Android SDK, not the standard Java interface. Because it’s designed not 
to use reflection, it requires the developer to be explicit about the marshaling 
process, making it more tedious to use. However, despite this complication, using 
Parcelable can result in better app performance — although the gain in performance 
is usually imperceptible to the user.
Parcelable is often used when passing data between activities in a 
Bundle
.
Saving Data on Android
Chapter 1: Using Files
raywenderlich.com
38


Note
: The Parcelable API is not for general purposes. It’s designed to be a 
high-performance IPC transport. It’s not appropriate to place Parcel data into 
persistent storage because any change to the underlying implementation of 
the data can render the old data unreadable.
Key points
• Files are a quick way to persist data in Android.
• The internal storage is a great place to store files that are specific and private to 
your app.
• Use the internal cache to store temporary files.
• Use external storage to store files that you want users or other apps to have access 
to.
• External files are persistent, even after the app is uninstalled.
• Internal files are deleted when the app is uninstalled.
• To write files to the external storage, the correct permissions must be set in the 
manifest.
• Because the external storage is not secure, it’s a good idea to use AES encryption 
with a password-based generated key.
• As a general security practice, apps that store data files should not be allowed to 
be installed on external storage.
• Serializable and Parcelable are ways of marshaling data for transport or storage.
• Do not use Parcelable to store persistent data; if the Parcel is changed, the old 
data will not be read properly.
Saving Data on Android
Chapter 1: Using Files
raywenderlich.com
39



Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   37   38   39   40   41   42   43   44   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish