Search code examples
javaandroideclipseandroid-manifestandroid-implicit-intent

Android:app creation malfunction(Implicit Intent)


I have two applications where the one opens by implicit intentthe other one.So in the first application I create an Intent and where I wrote i.setAction("com.example.secondApp");and I launch it through startActivity(i);

Then on the second app I change the manifest(filter) like:

  <intent-filter>
           <action android:name="com.example.secondApp" />

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

plus I do all the creation intent in the java section.

*code tested because everything was done by explicit intent in the first place and worked fine

So my point is when I try to run them both the first app installs nicely where the second one says that No Launcher activity found!obviously cause I changed it but despite it installs it isn't shown on the phone nor the first App detects the second one,any clue?

*Also when I leave the manifest(filter) of the second app at default values it installs fine.


Solution

  • If you want an activity to appear in the launcher, it needs the appropriate <intent-filter>:

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
    
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
    

    If you want that activity to have another <intent-filter>, that is fine. An <activity> can have as many <intent-filter> elements as needed.