title: What are intent-filters in Android?
body: <p>In my android app, I wanted to start an activity 'B' from initial activity 'A'. I have created classes for both of these. However when using following code to start B, I get a runtime error: <code>application has stopped unexpectedly, try again</code>. Here is my code:</p>
  
  <pre><code>Intent myIntent = new Intent(this, AddNewActivity.class);
  startActivity(myIntent); 
  </code></pre>
  
  <p>When I added a new entry in <code>AndroidManifest.xml/manifest/application/activity/intent-filers</code> for activity B then the application worked.</p>
  
  <p>I have two questions:</p>
  
  <ul>
  <li>When there are multiple activities entries in <code>AndroidManifest.xml</code>, how does android know which activity to start first?</li>
  <li>I could not understand intent-filters. Can anyone please explain.</li>
  </ul>
  
  <p>Here is my partial <code>AndroidManifest.xml</code></p>
  
  <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
      &lt;activity android:name=".ListAllActivity"
                android:label="@string/app_name"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".AddNewActivity" android:label="@string/app_name"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>