Reader small image

You're reading from  Hands-On Android UI Development

Product typeBook
Published inNov 2017
Reading LevelExpert
PublisherPackt
ISBN-139781788475051
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Jason Morris
Jason Morris
author image
Jason Morris

Jason Morris has been developing software for as long as he can remember. He's written software for the desktop, the server, for feature phones and for smart phones. He's written in many languages, and deployed in a variety of countries. Jason loves a good programming challenge, and when he's not writing code, or spending time with his family, taking photo's or camping: he's probably thinking about programming. In 2010 / 2011 he wrote Android User Interface Development: A Beginners Guide, which helped many beginner Android developers take their first steps into the realm of User Interface design and development for mobile devices.
Read more about Jason Morris

Right arrow

Creating an Entity model


Room, much like an SQL database, is optionally asymmetric; what you write to it might not be in the exact same format as what you read from it. When you write to a Room database, you save Entity objects, but when you read, you can read virtually any Java object. This allows you to define object models that best suit your user interface, and load them with JOIN queries rather than resorting to one or more additional queries for each object you wish to present to the user. While JOIN queries might be overly expensive on a server, on a mobile device they are often significantly faster than a multiquery alternative. As such, when defining an entity model, it's worth considering what you will need to save in your database as well as what specific fields you will need on your user interface. The data you need to write to storage becomes your entity, while the fields on your user interface become fields in Java objects that can be queried through Room.

An Entity class in...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Hands-On Android UI Development
Published in: Nov 2017Publisher: PacktISBN-13: 9781788475051

Author (1)

author image
Jason Morris

Jason Morris has been developing software for as long as he can remember. He's written software for the desktop, the server, for feature phones and for smart phones. He's written in many languages, and deployed in a variety of countries. Jason loves a good programming challenge, and when he's not writing code, or spending time with his family, taking photo's or camping: he's probably thinking about programming. In 2010 / 2011 he wrote Android User Interface Development: A Beginners Guide, which helped many beginner Android developers take their first steps into the realm of User Interface design and development for mobile devices.
Read more about Jason Morris