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) Using Parcelable Data Retrieving Parcelable Data

Why is no information on the items list?

After i did the Parcelable implementation, I run the project, i can see the list and the icons that there is by dafault, but i can't see the information that I retrieve from forecast IO, the first page (MainActivity) looks ok, but when I clicked on the 7 days button I just see the 8 items on the list and the 2 icons... but no info.

I debugged the parcelable data that i get from Main Activity and there is the data array info with the daily info into the array that i pass to the adapter but still not display info.

you can see my code here

https://github.com/juanjoseab/treehouseForecast

Thanks and kind regards for any comment!

2 Answers

Sagar Suri
Sagar Suri
6,043 Points

In your DayAdapter.java remove the if statement: If(convertView==null) put all the code inside if and else statment together.There is no requirement for the if condition.

Thanks Sagar Suri I Did what you told me but i still seen the same, here is what i see:

https://gyazo.com/31dbde0bafc6d1c0054946e51c15a2fc

Regards!!

Sagar Suri thanks I just fixed my problems just the way you told me, i did the wrong way, sorry, i take out the values set out of the else the fixed code for the getView Method on the adapter just look like this: Thanks!!!

public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            //brand new
            convertView = LayoutInflater.from(this.mContext).inflate(R.layout.daily_list_item, null);
            holder = new ViewHolder();
            holder.iconImageView = (ImageView) convertView.findViewById(R.id.iconImageView);
            holder.temperatureLabel = (TextView) convertView.findViewById(R.id.temperatureLabel);
            holder.dayLabel = (TextView) convertView.findViewById(R.id.dayLabel);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }

        Day day  = mDays[position];
        holder.iconImageView.setImageResource(day.getIconId());
        holder.temperatureLabel.setText(day.getTemperatureMax() + "");
        holder.dayLabel.setText(day.getDayOfTheWeek());
        return convertView;
    }