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 trialJason S
16,247 PointsHow does textview refer to the listview to be empty?
how does the textview connected to the listview other than they are in the relative layout? could i have two listviews and wouldn't the textview not know which one it would be referring to?
1 Answer
jon1234
5,022 PointsI think in that case you can explicitly define which textview is the empty text for each listview. have a look at the listView.setEmptyView documentation
Jason S
16,247 PointsJason S
16,247 Pointsohh so if you only have one listview then the textview automatically assumes that it is referring to that listview?
jon1234
5,022 Pointsjon1234
5,022 PointsAs long as that textView has the id of
@android:id/empty
and the listView has the id of@android:id/list
then yes it will automatically act as the empty text for the listview