0

Within my application I am getting the following error from logcat, What is the error with my code? I have searched for over an hour online and cannot solve the issue.

It is relating to the intent that I am trying to use in order to open up a new activity but I am not sure how to solve it.

   07-20 20:02:18.976: E/AndroidRuntime(7381): FATAL EXCEPTION: Thread-9022
07-20 20:02:18.976: E/AndroidRuntime(7381): Process: com.example.brianapp, PID: 7381
07-20 20:02:18.976: E/AndroidRuntime(7381): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.brianapp.MeditationResults }
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1672)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Activity.startActivityForResult(Activity.java:3511)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Activity.startActivityForResult(Activity.java:3472)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Activity.startActivity(Activity.java:3714)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at android.app.Activity.startActivity(Activity.java:3682)
07-20 20:02:18.976: E/AndroidRuntime(7381):     at com.example.brianapp.Meditation$2.run(Meditation.java:115)

It is relating from this code section as this error only occured once I changed this code section:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.meditation);

        //new thread
                Thread timer = new Thread() {

                    /**
                     * Method that firstly starts the thread and makes it sleep,
                     * then using intents opens the main activity using
                     * a reference to its name
                     */
                    public void run() {

                        try {
                            //sleep for 3.5 seconds
                            sleep(15000);
                        } catch (InterruptedException e) {
                            // exceptions caught here
                            e.printStackTrace(); 

                        } finally {

                        Intent openActivity = new Intent("com.example.brianapp.MeditationResults");
//                          //Start activity
                        startActivity(openActivity);


                        }
                    }

                };
                //Start timer
                timer.start();

The following is my manifest, note that I have included an intent filter for this class (meditation), the class I am trying to open with the intent is called MeditationResults:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.brianapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.brianapp.Menu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.brianapp.menu" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.brianapp.Meditation"
            android:label="Meditation" >
            <intent-filter>
                <action android:name="com.example.brianapp.meditation" />
                <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
        </activity>
        <activity
            android:name="com.example.brianapp.MeditationResults"
            android:label="@string/title_activity_meditation_results" >
        </activity>
        <activity
            android:name="com.example.brianapp.UserName"
            android:label="@string/title_activity_user_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.brianapp.ServerInterface"
            android:label="@string/title_activity_server_interface" >
        </activity>
    </application>

</manifest>

1 Answer 1

1

Change this in your manifest to

   <activity
            android:name="com.example.brianapp.MeditationResults"
            android:label="@string/title_activity_meditation_results" >
   </activity>

to

<activity
            android:name="com.example.brianapp.MeditationResults"
            android:label="@string/title_activity_meditation_results" >
            <intent-filter>
                <action android:name="com.example.brianapp.MeditationResults" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
</activity>
1
  • Thanks a lot, this has solved the problem (and saved me a sleepless night lol)
    – Rjni2014
    Jul 20, 2014 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.