android.content.ActivityNotFoundException:

前端 未结 24 1872
一生所求
一生所求 2020-11-22 10:38

I am getting this exception while I am trying to call an activity from another one. The complete exception is

android.content.ActivityNotFoundExcept

相关标签:
24条回答
  • 2020-11-22 11:09

    when i have same issue. if you are using library class files and writing it into android manifest files write it like and then remove the library projects manifest files this portion>> then it will work absolutely..

    0 讨论(0)
  • 2020-11-22 11:09

    This exception also occurs if you include a library in your app and if the library is calling an activity defined in the library project. In this case we need to merge library's manifest with calling app's manifest.

    With ADT version 20, we can do this by adding the below statement in project.properties of calling app.

    manifestmerger.enabled=true

    0 讨论(0)
  • 2020-11-22 11:12

    I was using getActivityContext() (instead of Activity.this) for the menu code to save some work, and copy-and-paste it to each activity without editing each time.

    I replaced them with Activity.this, and the issue is gone.

    I have a feeling a smarter Android guy could work-around not having to do that. Would like to hear what it would be.

    0 讨论(0)
  • 2020-11-22 11:13

    Restart the Eclipse and check your Manifestfile again. If you find missing the respective Activity, then add it and try again. It solved my similar issue.

    0 讨论(0)
  • 2020-11-22 11:14

    intent.setClass takes parameters as "Package Context" and "Class". an example would be:

    intent.setClass(CurrentActivity.this, TargetActivity.class);
    

    also you need to check if the activity is registered in manifest file.

    0 讨论(0)
  • 2020-11-22 11:16

    Activity you're calling sholdn't contain "sheme" and contain intent-filter:

    <activity android:name=".SecondActivity">
            <intent-filter>
                   <action android:name="com.example.sj.myapplication.SecondActivity"/>
                   <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
    </activity>
    

    so in calling code:

    Intent intent=new Intent("com.example.sj.myapplication.SecondActivity");
    startActivity(intent);
    
    0 讨论(0)
提交回复
热议问题