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 an Interactive Story App (Retired) The Model-View-Controller Pattern Creating the Story

My setChoice1 and setChoice2 are not recognized.

My setChoice1 and setChoice2 are not recognized. Aondroid Studion says: Cannot resolve method.

package com.adiko.interactivestory.Model;

import com.adiko.interactivestory.R;

public class Story { private Page[] mPages;

public Story(){
    mPages = new Page[7];

    mPages[0] = new Page();
    mPages[0].setImageId(R.drawable.page0);
    mPages[0].setText("test");
    mPages[0].setChoice1(new Choice());
    mPages[0].setChoice2(new Choice());

}

}

My Choice class: package com.adiko.interactivestory.Model;

public class Choice { private String mText; private int mNextPage; private Choice mChoice1; private Choice mChoice2;

public String getText() {
    return mText;
}

public void setText(String text) {
    mText = text;
}

public int getNextPage() {
    return mNextPage;
}

public void setNextPage(int nextPage) {
    mNextPage = nextPage;
}

public Choice getChoice1() {
    return mChoice1;
}

public void setChoice1(Choice choice1) {
    mChoice1 = choice1;
}

public Choice getChoice2() {
    return mChoice2;
}

public void setChoice2(Choice choice2) {
    mChoice2 = choice2;
}

}

2 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Are the setChoice1() and setChoice2() methods defined in your Page class (not the Choice class)?

Hi Jon,

You are right. I just put them in Choice class not into the Page class. Did not pay attention. Thank you very much for help and your time!