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 Improving Our Code Using the New Colors

parseColor does not appear

I do exactly as the video says to do but when it comes time to change Color to an int by using int ColorAsInt = Color.parseColor(Color); parse color option does not appear and when I type the line of code in myself Im just left with an error saying cannot resolve method 'parseColor()' and another error at return Color(); saying Found 'Java.lang.String', required : 'int'.

1 Answer

I Fixed the Problem. The Problem occurs if you capitalized the C in String Color = " "; In your ColorWheel page. So when you start typing int ColorAsInt = Color.parse Android Studio will think you are taking about your String Color = " "; and not android.graphics.Color So to fix this you when you are typing in int ColorAsInt = Color When the pull down menu of suggestions appear Click on Color (android.graphics) Which should input int ColorAsInt = android.grapics.Color Then continue with the video instructions and type parseColor(Color); Right after android.graphics.Color.

So the line of code should look like this int ColorAsInt = android.graphics.Color.parseColor(Color);

Instead of this int ColorAsInt = Color.parseColor(color);