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 coding crystal ball

Getting error coding for crystalBall

The method setImageResource(int) in the type ImageView is not applicable for the arguments (Object)

private void animateCrystalBall(){
        ImageView crystalBallImage = (ImageView)findViewById(R.id.imageView1);
        crystalBallImage.setImageResource(R.drawable.ball_animation);
    }

Also iam not getting the same pop up with all images only the first image shows up.

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

The code you posted looks okay...can you post your entire MainActivity.java file as well as your activity_main.xml file? On the off chance that it's simply something wrong with how your R file is being generated, try cleaning and rebuilding your project. In the menu at the top, select Project > Clean... and then select your Crystal Ball project.

If we can't help you in the forum, you can always zip up your project code and email it to help@teamtreehouse.com for us to take a look.

I decided too take lesson over again as it wasn't to bad and helps me remember details better . I deleted code to start fresh. If I encounter same problem I will let you know.

Thank you for getting back to me.

Chris Lundberg