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

alex gwartney
alex gwartney
8,849 Points

Weather app giving empty list

Not sure what is going on but when i fisnihed the list view data it comes up with empty data. When then found out i was not using setListAdapter it then just started crashing.

public class DailyForcastActivity extends ListActivity {


    private Day[] mDays;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_daily_forcast);

        Intent intent = getIntent();

        Parcelable[] parcelables = intent.getParcelableArrayExtra(MainActivity.DAILY_FORCAST);

        mDays = Arrays.copyOf(parcelables,parcelables.length,Day[].class);

        DayAdapter adapter = new DayAdapter(this,mDays);

        setListAdapter(adapter);

    }


}
alex gwartney
alex gwartney
8,849 Points

Let me know if you want more of the code i think it has to do with this piece but not sure

Hi Alex, Your post was really helpful, because I also forgot to add setListAdapter. Now my List View works with no problem. If you still didn't solve your problem with a List View I'm ready to help.