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 trialHala Almaimoni
332 PointsThe interactiveStory page doesn't work
I got this error:
2019-08-27 11:32:55.314 6121-6121/com.example.intractivestory E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.intractivestory, PID: 6121 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.intractivestory/com.example.intractivestory.ui.StoryActivity}: android.content.res.Resources$NotFoundException: Drawable com.example.intractivestory:string/page0 with resource ID #0x7f0b0029 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: android.content.res.Resources$NotFoundException: Drawable com.example.intractivestory:string/page0 with resource ID #0x7f0b0029 Caused by: android.content.res.Resources$NotFoundException: File 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." from drawable resource ID #0x7f0b0029 at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:876) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:659) at android.content.res.Resources.getDrawableForDensity(Resources.java:906) at android.content.res.Resources.getDrawable(Resources.java:845) at android.content.Context.getDrawable(Context.java:687) at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:463) at com.example.intractivestory.ui.StoryActivity.pageLoad(StoryActivity.java:46) at com.example.intractivestory.ui.StoryActivity.onCreate(StoryActivity.java:41) at android.app.Activity.performCreate(Activity.java:7802) at android.app.Activity.performCreate(Activity.java:7791) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) Caused by: java.io.FileNotFoundException: 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." at android.content.res.AssetManager.nativeOpenNonAsset(Native Method) at android.content.res.AssetManager.openNonAsset(AssetManager.java:941) at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:865) at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:659) at android.content.res.Resources.getDrawableForDensity(Resources.java:906) at android.content.res.Resources.getDrawable(Resources.java:845) at android.content.Context.getDrawable(Context.java:687) at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:463) at com.example.intractivestory.ui.StoryActivity.pageLoad(StoryActivity.java:46) at com.example.intractivestory.ui.StoryActivity.onCreate(StoryActivity.java:41) at android.app.Activity.performCreate(Activity.java:7802) at android.app.Activity.performCreate(Activity.java:7791) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 2019-08-27 11:32:55.337 6121-6121/com.example.intractivestory I/Process: Sending signal. PID: 6121 SIG: 9
1 Answer
Tom Achki
3,680 PointsPlease provide your code or we will not be able to see what is wrong.
Check this out though. I think you have mistake in creating String resource
Caused by: android.content.res.Resources$NotFoundException: Drawable com.example.intractivestory:string/page0 with resource ID #0x7f0b0029 Caused by: android.content.res.Resources$NotFoundException: File 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." from drawable resource ID #0x7f0b0029
Hala Almaimoni
332 PointsHala Almaimoni
332 PointsThis is the Story class:
package com.example.intractivestory.model;
import com.example.intractivestory.R;
public class Story { private Page[] pages;
}
This is StoryActivity page:
package com.example.intractivestory.ui;
import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView;
import com.example.intractivestory.R; import com.example.intractivestory.model.Page; import com.example.intractivestory.model.Story;
public class StoryActivity extends AppCompatActivity { private Story story; private String name; private ImageView storyImageView; private TextView storyTextView; private Button choice1Button; private Button choice2Button;
}