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 Simple Android App (retired 2014) Pretty Little Things Customizing Buttons and Labels

ImageView

Hi Everyone,

Thanks for your previous assistance however, I soon worked out that I left a curly bracket which corrected the warning.

Pressing on with the Crystal Ball where we place an image on the project displays this warning message on the first line. "Missing Content Description attribute on image". <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitCenter" android:src="@drawable/ball01" />

However if I used the suggested fix it option it add content on the last line. Now it displays two warning 1."Empty Content Description attribute on image". 2.HARDCODIGN string TODO should use @string resource.

<ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitCenter" android:src="@drawable/ball01" android:contentDescription="TODO"/>

Your feedback is greatly appreciated. Thanks Daniel

2 Answers

william parrish
william parrish
13,774 Points

Well, the first warning is for the content description, which is just text that will be read to a visually impaired user, to help them understand what they are being presented.

The second error is (and likely related to the insertion of your content description fix it) because within your xml you will have text that is put in as " whatever words you have put in " instead of creating a string resource, and linking it in your xml, which would instead like like android.r.string.your_string_name_here

Does this make sense?

I recommend you review your xml files for any occurence of text that is not referenced as a string resource ( it will look like just characters in between " " ) and create and link string resources to be used instead of the hardcoded text.

Thanks I was looking at the problem more complicated rather than brake it down into step. Cheers