Generic code to populate listview