Now this is a Story…P2.

More accurately, imagine a us playing soccer on the basketball court.

In West Africa, born and raised, on a playground is where I spent most of my days, chilling out maxin’ relaxin’ all cool, playing some soccer inside the school. Man, I played so much soccer growing up. SHEESH. I think I was supposed to be studying more, but out in the mean streets of Africa (because Africa is OBVIOUSLY a country), what you did with your feet was more important than what you did with the books. Oh well, c’est la vie.

So to refresh your mind (Last week on ‘Now this is a Story’)…

I’m six weeks deep into this Android Development Immersive course that was co-created by Google and General Assembly. It’s going well, but it requires many hours of coding. However, through it all, I am enjoying it.

We have learned a lot of stuff over the past few weeks. Our first week of class we were already building tiny android apps. The first app I built was an app that when a button was pressed, the color of the button was changed and text was changed to represent the name of the color. It was a pretty sweet app. I’m sure you’re wishing you could buy the app for 99 cents, but alas, it was just a prototype.

I know, I know, that app sounds terrible, and it was terrible, but it was the first app I ever created, and it was actually difficult to build. I mean I went from knowing nothing about Java, XML, or the Android Studio, and then I made an app that you could press a button and it changed text and colors.

So what did I learn in building that app? First I needed to know how to create buttons in the Android Studio using XML. I also needed to know how to make those buttons come alive (what developers call instantiating). Once the buttons where alive and ready for me to be able to use, I needed to be able to press them. This is where we can use these wonderful things called Event Listeners. Event listeners are a method that essentially let you generate a response to an action. So in plain english, in your app, if you have a button and you want that button to go to the next page when you press it, you create an event listener for that button so that it ‘listens’ for when you press the button, and the ‘event’ or going to the next page occurs. I like event listeners, you can put them in so many places! Obviously you should only put them in places that makes sense, but you get what I’m saying.

We have learned a lot of topics during this course, and for the purpose of not boring you to pieces, I won’t cover every single one of them. However, I did promise that I will share with you something that I know well, and something I don’t know well. My “know well” for the day was event handlers, and for the something that I don’t know so well, I’m going to go with Custom Adapters.

Custom Adapters huh? Yep.

In android development, we use objects, or things, called adapters. The way I like to think of adapters are like this: Imagine you have just bought a new calendar that you’re going to put up on your fridge. At this point, the calendar is empty. Now imagine you have sat down and written a list of things you want to put on that calendar, and now you just need to put them on there. Well this is where an adapter shines. An adapter is like a generator that you can put your list of things you have written down into, and it will then display it onto your calendar. So essentially an adapter is a link between your data, and how you want your data to be displayed on the screen.

You can see that adapters are powerful, and you can use them to create all sorts of views that a person sees on the screen, but they are more difficult to create than they seem. The android studio, the software used to create android apps, gives you some adapters that you can use just by calling them, but what happens when you want your home page to look a specific way and the android studio adapters won’t work? That’s when you have to create a custom adapter. Now this is where my knowledge starts getting a little bit hazy, and I will try my best to describe how it is supposed to work.

To create a custom adapter, you need create a new java class where you will build the adapter, and an xml layout file of how you want the adapter to look. How exactly you build it I don’t understand very well, but I know that you have create a method or few, so that you can call those methods. Once you have created the custom adapter, you now can use it to inflate, or fill up, a certain view on your screen. So for instance, if you have a basic list that just holds people’s name, you can build the custom adapter so that with the name, it also has the persons picture, an icon, and other important information that you want.

To be honest, I’m still learning how to create custom adapters and all the steps needed, but I hope you have a basic understanding of what adapters are and why you would want to create a custom adapter.

I think I need a break because custom adapters got me like:

I bid you farewell.

Cheers,

jafoole | Simon

Want to stay up to date with my progress, follow me on github and twitter @jafoole.

Like what you read? Give Simon Babba a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.