Intent not working - Activity not found

Slugshead

I have three intents to switch layouts etc.

Only the first seems to work and the other two are from what I can see, identical. I don't know if I have been staring at this for too long now and I am missing something stupid. Any suggestions?

Before anyone says, I've changed the actual package name etc to com.mysite.myapp. The originals are all spelt as I need them to be.

From my MainActivity

public class MainActivity extends Activity {

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

Button general1 = (Button)findViewById(R.id.btngeneral);
            general1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent i = new Intent("com.mysite.myapp.general");
                    startActivity(i);                   
                }
            });

        Button health1 = (Button)findViewById(R.id.btnhealth);
            health1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent i = new Intent("com.mysite.myapp.health");
                    startActivity(i);                   
                }
            });

        Button navi1 = (Button)findViewById(R.id.btnnavi);
            navi1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent i = new Intent("com.mysite.myapp.navi");
                    startActivity(i);                   
                }
            });

The first one there works totally fine as expected it should.

This is from my manifest:

<activity
        android:name="com.mysite.myapp.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".general"
        android:label="@string/app_name" 
        android:configChanges="orientation"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="com.mysite.myapp.general" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".health"
        android:label="@string/app_name" 
        android:configChanges="orientation"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="com.mysite.myapp.health" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".navi"
        android:label="@string/app_name" 
        android:configChanges="orientation"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="com.mysite.myapp.navi" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

The class of the working intent

    public class general extends MainActivity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.general);
        }
}

The classes of the two non working intents

    public class health extends MainActivity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.health);
        }
}

and

    public class navi extends MainActivity {

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

}

I hope someone has some good suggestions as I've been staring at this now for far too long.

Gopal Gopi

First check your Application package (the package name that you declared in manifest) and all Activities package names are same... if yes, your code should work. if no, declare your Activities in manifest with fully qualified package name

if not yet, try this (give least preference to below way)

replace

Intent i = new Intent("com.mysite.myapp.general");
startActivity(i);   

with

Intent i = new Intent(MainActivity.this,general.class);
startActivity(i);   

and do change for other things also

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

No Activity found to handle Intent

From Dev

In login activity, intent is not working

From Dev

no activity found to handle intent, android

From Dev

Android - No Activity found to handle Intent

From Dev

No Activity found to handle Intent exception

From Dev

startActivityForResult: No Activity found to handle Intent

From Dev

Intent is not working for moving fragment to activity

From Dev

No activity found to handle Intent/no launcher activity found manifest file issue

From Dev

Android Activity Not Found Exception: No Activity Found to handle Intent

From Dev

No Activity found to handle Intent when using FileProvider

From Java

Android 10 - No Activity found to handle Intent

From Dev

Adding intent to MainActivity results in "No Launcher activity found"

From Dev

No activity found to handle intent action.dial

From Dev

Android - Java - No Activity Found to Handle Intent

From Dev

No Activity found to handle Intent { act=android.intent.action.DIAL }

From Dev

No activity found to handle Intent - android.intent.action.OPEN_DOCUMENT

From Dev

Working with multiple activity and keeping the same value of intent

From Dev

intent to next activity, toast, progress bar not working

From Dev

Activity not found exception occurs when new activity is started using Intent

From Dev

No Activity found to handle Intent, cant find solution android application

From Dev

I keep getting error "No Activity found to handle Intent"

From Dev

ActivityNotFoundException: No Activity found to handle Intent (RECOGNIZE_SPEECH)

From Dev

android.content.ActivityNotFoundException: No Activity found to handle Intent - From Service

From Dev

android Intent.FLAG_ACTIVITY_REORDER_TO_FRONT not working as intended

From Dev

Why is the email Intent not working from Common (non Activity) class

From Dev

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW

From Dev

No activity found to handle Intent android.intent.action.REQUEST_TANGO_PERMISSION (has extras)

From Dev

No Activity Found to handle Intent (act=android.intent.action.VIEW) Trying to Install APK

From Dev

URL Redirection not working in Android via Intent - (Page Not Found Error)

Related Related

  1. 1

    No Activity found to handle Intent

  2. 2

    In login activity, intent is not working

  3. 3

    no activity found to handle intent, android

  4. 4

    Android - No Activity found to handle Intent

  5. 5

    No Activity found to handle Intent exception

  6. 6

    startActivityForResult: No Activity found to handle Intent

  7. 7

    Intent is not working for moving fragment to activity

  8. 8

    No activity found to handle Intent/no launcher activity found manifest file issue

  9. 9

    Android Activity Not Found Exception: No Activity Found to handle Intent

  10. 10

    No Activity found to handle Intent when using FileProvider

  11. 11

    Android 10 - No Activity found to handle Intent

  12. 12

    Adding intent to MainActivity results in "No Launcher activity found"

  13. 13

    No activity found to handle intent action.dial

  14. 14

    Android - Java - No Activity Found to Handle Intent

  15. 15

    No Activity found to handle Intent { act=android.intent.action.DIAL }

  16. 16

    No activity found to handle Intent - android.intent.action.OPEN_DOCUMENT

  17. 17

    Working with multiple activity and keeping the same value of intent

  18. 18

    intent to next activity, toast, progress bar not working

  19. 19

    Activity not found exception occurs when new activity is started using Intent

  20. 20

    No Activity found to handle Intent, cant find solution android application

  21. 21

    I keep getting error "No Activity found to handle Intent"

  22. 22

    ActivityNotFoundException: No Activity found to handle Intent (RECOGNIZE_SPEECH)

  23. 23

    android.content.ActivityNotFoundException: No Activity found to handle Intent - From Service

  24. 24

    android Intent.FLAG_ACTIVITY_REORDER_TO_FRONT not working as intended

  25. 25

    Why is the email Intent not working from Common (non Activity) class

  26. 26

    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW

  27. 27

    No activity found to handle Intent android.intent.action.REQUEST_TANGO_PERMISSION (has extras)

  28. 28

    No Activity Found to handle Intent (act=android.intent.action.VIEW) Trying to Install APK

  29. 29

    URL Redirection not working in Android via Intent - (Page Not Found Error)

HotTag

Archive