Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Material Design

You're reading from   Learning Material Design Master Material Design and create beautiful, animated interfaces for mobile and web applications

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785289811
Length 186 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Nadir Belhaj Nadir Belhaj
Author Profile Icon Nadir Belhaj
Nadir Belhaj
Kyle Mew Kyle Mew
Author Profile Icon Kyle Mew
Kyle Mew
Arrow right icon
View More author details
Toc

Connecting a dataset


Android comes equipped with the SQLite library, which is a powerful tool for creating and managing complex databases. One could easily fill an entire chapter, or even a whole book, on the subject, but as this does not really bear any relation to Material Design, we will create a very simple dataset just so that we can test out our RecyclerView.

If you would like to learn more about SQLite, comprehensive documentation can be found at http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html.

For the sake of brevity, the example here contains only three entries; however, it is very easy to expand if you choose. To add this data, create a new Java class called Contact.Java and complete like so:

public class Contact {
intprofilePic;
    String name;
    String status;
private List<Contact> contacts;

Contact(intprofilePic, String name, String status) {
this.profilePic = profilePic;
this.name = name;
this.status = status;
    }

private void loadData...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime