Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!