Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Activity Lifecycle The Project Creating the Adapter

Alex Londono
Alex Londono
2,033 Points

How did you know you needed a list adapter and more importantly, that you needed to extend base adapter?

How did you know you needed a list adapter and more importantly, that you needed to extend base adapter?

1 Answer

Ben's solution to the problem was to use a ListView to display the list of rows with a hole number, stroke count, minus and plus button. Every list needs some kind of adapter because an adapter is a bridge between a list and a datasource. In other words, the adapter for this project is what helps the list know what should be displayed for each row. A Base Adapter is a superclass which is used for a number of Adapter types. In other words, it is what gives an adapter its ability to act as a bridge between the list and a datasource. It does so by doing some work for you in the background provided you implement its required methods. But using a Base Adapter was not the only way. It was also possible to use an Array Adapter. It you were to use a RecyclerView, it has its own Adapter pattern. This is the case where there is more than one way to solve the same problem but as Ben said you should not worry if your way of solving the problem is the same as his, just so long as yours works.