O'Reilly logo

Expert Android by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    4

JSON for On-Device Persistence

A key aspect of mobile applications or games is the need for persistence on the device. Android provides a number of very good options for persistence, including relational storage. However, all the provided mechanisms that use the relational storage take a sizable amount of development time. This chapter provides a shortcut for a number of simple to medium persistence needs. The approach uses GSON/JSON technology to store object trees directly in non-SQL storage, such as the shared preferences and internal file storage.

JSON stands for JavaScript Object Notation. GSON is a Java library from one of Google Projects that uses JSON structure to serialize and deserialize Java objects to strings.

You will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required