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 Lists and Adapters (2015) Lists with RecyclerViews Using a Layout Manager

Jacob Pickens
Jacob Pickens
3,435 Points

The time label for my list item only displays 9 AM

My app only displays 9 AM inside my time label text view even though I debugged it and found that each time attribute was different for each hour. Why is every time label the same then?


package com.pickens.weatherapp.adapters;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.pickens.weatherapp.R;
import com.pickens.weatherapp.weather.Hour;

public class HourAdapter extends RecyclerView.Adapter<HourAdapter.HourViewHolder> {

    private Hour[] hours;

    public HourAdapter(Hour[] hours) {
        this.hours = hours;

    public HourViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.hourly_list_item, viewGroup, false);
        HourViewHolder viewHolder = new HourViewHolder(view);
        return viewHolder;

    public void onBindViewHolder(HourViewHolder holder, int i) {

    public int getItemCount() {
        return hours.length;

    public class HourViewHolder extends RecyclerView.ViewHolder {

        public TextView timeLabel;
        public TextView temperatureLabel;
        public TextView summaryLabel;
        public ImageView iconImageView;

        public HourViewHolder(View itemView) {
            timeLabel = (TextView) itemView.findViewById(R.id.timeTextLabel);
            temperatureLabel = (TextView) itemView.findViewById(R.id.temperatureLabel);
            summaryLabel = (TextView) itemView.findViewById(R.id.summaryLabel);
            iconImageView = (ImageView) itemView.findViewById(R.id.iconImageView);

        public void bindHour(Hour hour) {
            temperatureLabel.setText(hour.getTemperature() + "");


1 Answer

Jon Kussmann
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Jacob,

Would you mind posting the code to your adapter that is setting the time values?