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) Intents and Multiple Activities Sending Data to a New Activity

Ragesh Kanagaraj
Ragesh Kanagaraj
3,637 Points

Unfortunately app stopped Error while starting Intent

I tried re creating the same scenario, created a layout for new Activity. When I start the Intent I am getting a series of logs, and in my emulator it says unfortunately app not working.

My Logs : Process: com.example.ragesh.mystory, PID: 8743 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ragesh.mystory/com.example.ragesh.mystory.StoryStart}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1761) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485) at android.app.Activity.startActivityForResult(Activity.java:3736) at android.app.Activity.startActivityForResult(Activity.java:3697) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) at android.app.Activity.startActivity(Activity.java:4007) at android.app.Activity.startActivity(Activity.java:3975) at com.example.ragesh.mystory.MainActivity.startStory(MainActivity.java:41) at com.example.ragesh.mystory.MainActivity.access$000(MainActivity.java:15) at com.example.ragesh.mystory.MainActivity$1.onClick(MainActivity.java:31) at android.view.View.performClick(View.java:4756) at android.view.View$PerformClick.run(View.java:19749) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

MyCode :

public class MainActivity extends ActionBarActivity { private static final String TAG=MainActivity.class.getSimpleName();

private EditText enterNameWiget;
private Button startStoryButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    enterNameWiget=(EditText) findViewById(R.id.idEditText);
    startStoryButton=(Button) findViewById(R.id.idButton);
    startStoryButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startStory();


        }
    });
}

private void startStory() {

    Intent intent=new Intent(MainActivity.this,StoryStart.class);
    startActivity(intent);
}

}

1 Answer

Abdalla Ali
Abdalla Ali
2,972 Points

Hi Ragesh,

From the log i can see that you trying to start an Intent by going to another activity called (StoryStart) which you have not declared in Manifest file.

Here is the important part of the log that is showing you the problem:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ragesh.mystory/com.example.ragesh.mystory.StoryStart}; have you declared this activity in your AndroidManifest.xml?

Solution: Please declare that activity in Manifest file.

Happy coding :)

Abdalla.