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) Standard ListViews Creating a ListView

I need help! Challenge : Change the ID for this ListView to the Android ID for a list. Remember that Android system IDs

Change the ID for this ListView to the Android ID for a list. Remember that Android system IDs start with @android:id/. Challenge Task 2 of 2

Please help me!

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >
    </ListView>        

</RelativeLayout>

android:id="@android:id/list"

2 Answers

Hey Channon,

So the instructions want you to change the ID of the ListView. So when you have at the ListView element you realize that the first attribute sets the ID and that where you have to change the ID.

Here is how it should look like:

   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >
    </ListView>        

</RelativeLayout>

I hope that was helpful, Patrick :-)

Thanks a lot!!!1!!1!! Can you please help me with this other challenge

https://teamtreehouse.com/library/android-lists-and-adapters/standard-listviews/handling-a-lack-of-data

Thanks Pat! : D

<ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" > </ListView>

Thanks man, Patrick already helped me on this challenge I still appreciate the help thoe