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 trialSara Grim
5,285 PointsAfter running the program, I get "cannot resolve the symbol class Random & cannot resolve method 'next.Int (int)'.
What should I do to resolve the Random alerts after coding for the random numbers?
3 Answers
Stone Preston
42,016 Pointswhen typing methods and classnames, when you choose the autocomplete value android studio automatically imports the class if needed. If you dont use the autocomplete value, then you have to import it yourself. you must not have used the autocomplete value when typing Random. to fix this, just import the Random class by adding this to the top of your file below the package declaration
import java.util.Random;
Sara Grim
5,285 PointsThank you Stone. It worked! Where is the autocomplete, so I can use it?
Stone Preston
42,016 Pointsautocomplete is just the box that comes up whenever you are typing code. it recognizes what you are typing and shows suggestions. It should be on automatically, but if not you can enable it in your editor preferences
Alvaro Gutierrez
1,471 PointsI just used the auto complete and it resolve my issue. Thanks!
Twinnie Ting
Courses Plus Student 2,441 PointsJust to add: to autocomplete in MAC - hover your mouse cursor to the small pop up box and then click - Alt + enter, it would then autocomplete.
Twinnie Ting
Courses Plus Student 2,441 PointsJust to add: to autocomplete in MAC - hover your mouse cursor to the small pop up box and then click - Alt + enter, it would then autocomplete.
Sara Grim
5,285 PointsSara Grim
5,285 PointsI am using the Android Studio for "Fun Facts Activity". ```Javascript String fact = ""; Random randomGenerator = new Random(); int randomNumber = randomGenerator.nextInt(3); fact = randomNumber + "";