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 Build a Blog Reader Android App Adapting Data for Display in a List Cleaning Up Our Presentation

Noam Elbaz
Noam Elbaz
5,672 Points

Empty Text View (Blog Reader - Stage 4 - Adapting Data for Display in a list)

I'm on Android Studio: A few minutes in to the video, Ben switched a textView into an empty text view, which we will be referencing in code with the line: TextView emptyTextView = (TextView) getListView().getEmptyView();

i did not see any easy option to switch the textView to an Empty text view in android studio and setting the text in the XML to = "" did not seem to work.

Stuck.

.... and yes i did google it.

Thanks

3 Answers

Did you set the id of the TextView to empty in the xml file?

<TextView  android:id="@android:id/empty"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />
Noam Elbaz
Noam Elbaz
5,672 Points

kylan hill - that's all he meant? to change the id to empty?

thanks.

Yes, np best of luck

Roman Kozak
Roman Kozak
3,119 Points

Worked for me, thanks!