This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes Cannot use Random type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Cannot use Random type" Watch "Cannot use Random type" New topic
Author

Cannot use Random type

Frits Broekhuis
Greenhorn

Joined: Jan 09, 2013
Posts: 2
Hi,

I'm quite new at Java, although I have other programming experience.

I'm trying to compile a code sample, which makes use of the Random type. The problem is that Eclipse produces the following error message:

The import android.util.Random cannot be resolved

This seems, strange, because in the Type Hierarchy browser I can easily find the unit and the Random type. I'm using Eclipse Juno, 20121004-1855 with Android SDK at API level 17. Not sure what other information would be needed to resolve this error.

Any help is greatly appreciated!

Effel
Frits Broekhuis
Greenhorn

Joined: Jan 09, 2013
Posts: 2
Sorry for bother you guys, I just found the solution: I should have imported java.util.Random, rather than android.util.Random!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot use Random type
 
Similar Threads
Frustrating eclipse - cannot be resolved to a type ?
Finished my program but have a big problem
StandardEmitterMBean Compile Error in Eclipse
Struts2 concepts doubts
Question re casting from Random.nextInt to char