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) Finishing the User Interface Creating the Story Layout

Dorka Tamas
Dorka Tamas
5,085 Points

Exception raised during rendering: radius must be > 0 Please help!

After I copied the text to the Story class, it went wrong. The system cannot identify page0 etc, it is red and not purple as it is in the video. If I hover over it, it gives me these options: create drawable resource file 'page0.xml' or create drawable resource file 'page0' or create field 'page0' or rename reference. I do not know which one I should coose. I cannot proceed with the ImageView, it says Exception raised during rendering: radius must be > 0, I cannot see the device.

This is my code:

Story.java: package com.dorkatamas.interactivestory.model;

import com.dorkatamas.interactivestory.R;

/**

  • Created by User2 on 2016.05.16.. */ public class Story { private Page[] mPages;

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

    mPages[0] = new Page(
            R.drawable.page0,
            "On your return trip from studying Saturn's rings, you hear a distress signal that seems to be coming from the surface of Mars. It's strange because there hasn't been a colony there in years. Even stranger, it's calling you by name: \"Help me, %1$s, you're my only hope.\"",
            new Choice("Stop and investigate", 1),
            new Choice("Continue home to Earth", 2));
    
    mPages[1] = new Page(
            R.drawable.page1,
            "You deftly land your ship near where the distress signal originated. You didn't notice anything strange on your fly-by, but there is a cave in front of you. Behind you is an abandoned rover from the early 21st century.",
            new Choice("Explore the cave", 3),
            new Choice("Explore the rover", 4));
    
    mPages[2] = new Page(
            R.drawable.page2,
            "You continue your course to Earth. Two days later, you receive a transmission from HQ saying that they have detected some sort of anomaly on the surface of Mars near an abandoned rover. They ask you to investigate, but ultimately the decision is yours because your mission has already run much longer than planned and supplies are low.",
            new Choice("Head back to Mars to investigate", 4),
            new Choice("Continue home to Earth", 6));
    
    mPages[3] = new Page(
            R.drawable.page3,
            "Your EVA suit is equipped with a headlamp, which you use to navigate the cave. After searching for a while your oxygen levels are starting to get pretty low. You know you should go refill your tank, but there's a very faint light up ahead.",
            new Choice("Refill at ship and explore the rover", 4),
            new Choice("Continue towards the faint light", 5));
    
    mPages[4] = new Page(
            R.drawable.page4,
            "The rover is covered in dust and most of the solar panels are broken. But you are quite surprised to see the on-board system booted up and running. In fact, there is a message on the screen: \"%1$s, come to 28.543436, -81.369031.\" Those coordinates aren't far, but you don't know if your oxygen will last there and back.",
            new Choice("Explore the coordinates", 5),
            new Choice("Return to Earth", 6));
    
    mPages[5] = new Page(
            R.drawable.page5,
            "After a long walk slightly uphill, you end up at the top of a small crater. You look around, and are overjoyed to see your favorite android, %1$s-S1124. It had been lost on a previous mission to Mars! You take it back to your ship and fly back to Earth.");
    
    mPages[6] = new Page(
            R.drawable.page6,
            "You arrive home on Earth. While your mission was a success, you forever wonder what was sending that signal. Perhaps a future mission will be able to investigate...");}
    

    } }

Choice.java:

package com.dorkatamas.interactivestory.model;

/**

  • Created by User2 on 2016.05.16.. */ public class Choice { private String mText; private int mNextPage;

    public Choice(String text, int nextPage) { mText = text; mNextPage = nextPage; }

    public String getText() { return mText; }

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

    public int getNextPage() { return mNextPage; }

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

PAge.java:

package com.dorkatamas.interactivestory.model;

/**

  • Created by User2 on 2016.05.16.. */ public class Page { private int mImageId; private String mText; private Choice mChoice1; private Choice mChoice2; private boolean mIsFalse = false;

    public boolean isFalse() { return mIsFalse; }

    public void setFalse(boolean aFalse) { mIsFalse = aFalse; }

    public Page (int imageId, String text, Choice choice1, Choice choice2) { mImageId = imageId; mText = text; mChoice1 = choice1; mChoice2 = choice2; }

    public Page (int imageId, String text) { mImageId = imageId; mText = text; mChoice1 = null; mChoice2 = null; }

    public int getImageId() { return mImageId; }

    public void setImageId(int imageId) { mImageId = imageId; }

    public String getText() { return mText; }

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

    public Choice getChoice1() { return mChoice1; }

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

    public Choice getChoice2() { return mChoice2; }

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

Seth Kroger
Seth Kroger
56,413 Points

Did you have any issues adding the image files your the drawable-***dpi folders are were you able to reference the title image Drawable correctly?