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

ERROR!

I'm having a problem. Eclipse is saying there is an error with the last line of this code. It says something about an @String. I cant run my program until I fix it.

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

I also have another problem, that I will post once this one is fixed. I don't understand how to fix this code because I didn't write it. Thank You for anyone who helps!

15 Answers

"TODO" is an embedded string literal and will give you a warning, heres a tip:

Right click on the string in question, click on quick fix and then extract string, this will refactor the string literal and put it into your string resources file, which will get rid of the warning.

Thank You so much! It actually got rid of Both of my errors! Time to program again!

ctrl-1 / cmd-1 is the quick fix shortcut, I couldn't live without it.

Best of luck to you!

May I ask you a question that I not on the topic of this exact code?

is*

Fire away Jack

If I were to get heavy into programming what kind of OS is better, a Windows or a Mac. Now, I know this is all opinion but, I can see that you are very experienced. Now, I used to think that Windows machines were the better and that's why I'm typing away at one now. But, I start to see everyone code on Apples now and I can't figure out why everyone made the switch. Now don't get me wrong, I love Macs, I use one all the time, that is my mothers. Okay, I'm kinda rambling on, but, my question was: Mac or Pc, software/ web development?

All platforms have their limitations, my advice to you would be to expose yourself to as much as possible so that you can experience those limitations, get to know whats happening under the hood and you will soon find your own answer to this question.

I use a mac and have done for several years, mainly because of the build quality and I really love linux. These operating systems are popular because of the underlying system (UNIX) which has for me become a joy to use. I recommend giving linux a try once you are done with the android projects, treehouse offer a great course on it.

I hope this helps you out! Just keep coding on whatever machine you have available.

Thank you that helped a lot. But, now Eclipse is saying that there is still an error whenever I try to run my program. This is the part in my track where I connected my android phone. I can't see any errors so I'm very confused. I also have restarted Eclipse and It says the same thing once re-booted

Is it running in the emulator? I know you need to install additional drivers in windows when debugging on an actual device.

Rather than re running videos it may be worth running through the android guide to running your app

Okay, Thank you. That link helped me out it is now running on my phone, but one problem. The text that is supposed to be inside the Crystal ball is at the top of my screen. Is that okay? One my program in eclipse it is set to be in the crystal ball. I also have to select a phone and that phone that I have selected isn't my phone. Could that be causing it?

on*

Nevermind, my linear layout is all jacked up and I can't get it to go back to the center of the screen

Have a play around with the interface builder in eclipse and try to get that label in the middle, then run the app, if it still isn't displaying correctly, take a look at the XML view and look at the positioning attributes, if the label is appearing at the top of the page then something must be telling it to be there!

Its been a long time since I did the crystal ball app but I think the positioning of elements on the screen is revisited a few times as the project goes on, so hang in there, you should figure it out.

Thanks Daniel. I'm watching older videos. Hopefully I'll figure it out. Thank you for all your help!