The backbone of Material Design is to design your user interface in a way that is simple and intuitive for users, in the same way we use our intuition with real life materials. One of the many ways this is achieved is through the use of elevation in Android UI components, demonstrated here:

Android Layout Visualizer

Continue Reading ...

In my last post I broke down the differences between the RecyclerView and a ListView. One of the benefits of the RecyclerView that I touched on was the ItemTouchHelper. This class is used to handle the Swipe-To-Dismiss and Drag-N-Drop behaviors of a RecyclerView. In this post I am going to teach you how to swipe to dismiss RecyclerView items using the sample application seen here:

Swipe To Dismiss

Continue Reading ...

Before continuing this post, I recommend that you read my previous one on Swipe To Dismiss RecyclerView Items as this will build upon the ItemTouchHelper class discussed there. Once you’ve done that, come back to this short post and learn how to drag and drop RecyclerView items like this:

Drag And Drop RecyclerView

Continue Reading ...

Introduced in API 21 (Android 5.0), along with other MaterialDesign components, was the RecyclerView widget. This widget is a more flexible version of the ListView, which to many developers was their go-to AdapterView for applications.

It is important to note here, though, that the RecyclerView does not extend from the AdapterView class. Intuitively, it sounds like it would as an AdapterView is defined in the docs as:

An AdapterView is a view whose children are determined by an Adapter.

In the AdapterView design, the Adapter is the component responsible for mapping content from the data source to the Views of an AdapterView which are displayed to the user. Through the use of Adapters and LayoutManagers, the RecyclerView is able to break up responsibilities of the layout and create opportunities for more unique designs, which are explained in further detail later. Before we discuss the opportunities given to us by the RecyclerView, let’s go over some of the benefits of the ListView (in comparison to the RecyclerView), and where it fell short.

Continue Reading ...

The singleton design pattern is a design that limits the instantiation of a class to a single object. To quote Wikipedia:

This is useful when exactly one object is needed to coordinate actions across the system.

A great example of this is the SQLiteOpenHelper, or any other data source object. Using more than one datasource to talk to an SQLite database on Android creates the opportunity for leaks in your SQLite connection, which we will discuss later. First, let’s talk about the proper way to use the SQLiteOpenHelper and the singleton pattern. This tutorial assumes you have already created the open helper class. If you do not have any experience with SQLite databases for Android, I recommend Lars Vogel’s tutorial.

Continue Reading ...