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

Copying text from MS Word into Java causes a lot of red errors in the text

In working on the Fun Fact App, I created my own fun facts in MS Word. When I copy them and paste into Java, many of the words are in red indicating errors. The words which do not appear in red, are in black. But, if I type the same text into Java, all the words are in green as it should be.

  1. Do I have to manually type all text into Java?
  2. Is it impossible to use copy and paste out of Word to get an error free result?

If there is a trick, let me know!

No need to answer this question - I found the answer all by myself! The mistake I made was that I added the quotation marks that surround the strings in Word, instead of in Android Studio.

1 Answer

Paste it into NotePad first, and then copy from there to Android Studio. That should do the trick. Programs like Word add a lot of formatting, whereas a program such as NotePad has none of that.

Thanks for the answer! Maybe you can help with this too: Is there and easy way to make one word in a string appear in bold?

string myName = "Hello, my name is Helena."

Helena must appear in bold.