An application must have a good looking UI and to get that we implemented our own custom layout to the listview to show songs in a playlist. Android provides ListView and various adapters which can be attached to it. For our purpose, we are using ArrayAdapter.
So to customize the listview, we need to have a customized ArrayAdapter. We would create a layout that we want each of the entry to have. We would override
getView(int position, View convertView, ViewGroup parent)
method and set our custom view.
Creating the layout
We first created a rough layout that we seemed to like.
Class that extends ArrayAdapter
AudioObject is a class that we made to handle audio metadata and other utilities.
A bit about ListView
ListView doesn’t load all the views at once. It reuses already drawn views. If you scroll down, it would reuse the views and not create new ones. In the
getView method, if
convertView is null it means that android is creating a new view. Most of the time it is not null because it reuses the previously created views.
Create Custom ListView
A little more advanced version of it looks like this.
P.S. Working on UI can be hectic.