I added a new class to my Android project and then declared it in my
main .java file like this:

Encounter EncounterGenerator;

However, I'm getting this error:

"Encounter cannot be resolved to a type"

My new class is in a separate file with the code listed below.

Is there anything I'm doing wrong?

Thanks!

package myStuff.HelloAndroid;

public class EncounterGenerator {

        public String EncounterGenerator() {
                String encounterText;
                int encounter;
                encounter = (int)(Math.random() * 3);

                switch (encounter) {
                case 0:  encounterText = "Encounter # 1";
                                 break;
                case 1:  encounterText = "Encounter # 2";
                                 break;
                case 2:  encounterText = "Encounter # 3";
                                 break;
                default: encounterText = "Encounter # 4";
                }
                return encounterText;
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to