O'Reilly logo

Android Design Patterns and Best Practice by Kyle Mew

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

The adapter pattern

In the example we have been studying here, we used an adapter pattern to connect our data with our layout in the form of our DataAdapter. This is a ready-made adapter and although it is clear how it works, it teaches us nothing about the structure of the adapter or how to construct one ourselves.

There are many cases where Android provides built in patterns, which is very useful, but there will often be times when we need an adapter for classes we have created ourselves, and we will now see how this is done and also how to create the associated design pattern, the bridge. It is best to begin by looking at these patterns conceptually.

The purpose of the adapter is perhaps the easiest to understand. A good analogy would be the ...

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