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 (2014) Improving Our Code Simple Refactoring: Creating a Class

Goran Penov
Goran Penov
1,635 Points

Cannot copy fragments of code from FunFactsActivity into FactBook

Hi! In the simple refactoring: creating a class section, i have a problem: when I try to copy the facts from my FunFactsActivity.java and paste them into my FactBook.java class, pops up a window: Select classes to import - 'The code fragment which you have pasted uses classes that are not accessible by import in the new content. Select classes that you want to import to the new file' and my only option to choose is java.util.random. If I click ok to import it, my class is full of errors.

Tnx in advice.

2 Answers

import java.util.Random is to import the Random class only...I think you have not made the FactBook class in funfacts package (where the FunFactsActivity class is there).

Goran Penov
Goran Penov
1,635 Points

No, I've made the FactBook class in the FunFacts package. When I move the cursor to the fact class, it says 'unknown class'. The error is still there.