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

General Discussion

Please Help!

I am having a problem with this line of code. Eclipse is telling me that I should use the @string attibute when hard coding the TODO on the last line of this:

''' <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"/> '''

Eclipse wont let me run on my android phone til i fix this. this is in the activity_main.xml

<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"/>

''' <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"/>'''

''' <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"/> '''

<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"/>

7 Answers

Hello Jack
String files in Java are usually stored with @string attribute. Are you using the editor or the xml file.? If you are using the editor just double click on the text you want to change or use the property panel to the right when you select a element like textarea or something to change the text.
Not sure if I did answer your question. Could you paste here the part of the xml in your main_activity file that is giving the error. Will be easier to find out the issue.

Thanks

my code dosent want to paste down. I'm having trouble.

''' Android <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"/> '''

Hi Jack, You need to use 3 backticks (next to 1 on the keyboard) to get your code to show. Also add a blank line before and after the backticks.

Hope that helps!

‘’’ <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"/> ‘’’

Some reason it seems that the forums don't like me pasting code. It shows the tic marks but thats it. I'll write the line of code out.

android:src="@drawable/ball01' android:contentDescription="TODO"/>

Oh my gosh, Thank you James. This is what I get for staying up this late I was using the apostrophes.

 <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"/>