Question

I have a small menu with a button that says "about". When I press it, the app force closes. The logcat says there is no activity found to handle the intent but I am unsure why. It is declared in the manifest as follows

<activity
            android:name=".About"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.androidsleepmachine.gamble.About" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

The intent start in the code

   case R.id.About:
    Intent i = new Intent("com.androidsleepmachine.gamble.About");
    startActivity(i);
    break;

Logcat file

05-08 23:13:19.258: E/AndroidRuntime(15746): FATAL EXCEPTION: main 05-08 23:13:19.258: E/AndroidRuntime(15746): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.androidsleepmachine.gamble.About } 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Activity.startActivityForResult(Activity.java:3389) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Activity.startActivityForResult(Activity.java:3350) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Activity.startActivity(Activity.java:3562) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Activity.startActivity(Activity.java:3528) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.androidsleepmachine.gamble.Home.onOptionsItemSelected(Home.java:83) 05-08 23:13:19.258: E/AndroidRuntime(15746): at android.app.Activity.onMenuItemSelected(Activity.java:2566) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:978) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874) 05-08 23:13:19.258: E/AndroidRuntime(15746): at com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.java:166)

Was it helpful?

Solution

try this,

    Intent i = new Intent(this,About.class);
// you may need to end this current activity if you dont want to use it anymore, just add `flags` to the intent 
startActivity(i);

in your manifest android:name= hit control and space at same time and choose your class from there to avoid any issues regarding pointing to your class.

OTHER TIPS

change the name like.

<activity
        android:name="com.androidsleepmachine.gamble.About"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

Logs shows the problem clearly.

Your are trying to start Activity of name com.AndroidSleepSounds.gamble.About

 com.AndroidSleepSounds.gamble.About

But, it is not in the Manifest .

 android:name="com.androidsleepmachine.gamble.About"

This is different class name . change it to

android:name="com.AndroidSleepSounds.gamble.About"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top