multiple intent filter to multiple activity
<p>i have two activity associated with two buttons </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
</code></pre>

<p></p>

<pre><code>&lt;application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"

    android:supportsRtl="true"
    android:theme="@style/AppTheme"&gt;





    &lt;activity

        android:name=".Subactivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar"
        android:taskAffinity="com.example.start_cs.sub"&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:label="@string/app_name"
        android:name=".sub"

        &gt;
    &lt;/activity&gt;

    &lt;activity

        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar" android:taskAffinity="com.example.start_cs.main"
        &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:label="@string/app_name"
        android:name=".main"

        &gt;
    &lt;/activity&gt;


&lt;/application&gt;
</code></pre>

<p></p>

<p>MainActivity code</p>

<pre><code>package com.example.start_cs.myapp;




Button button;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content_main);
    addListenerOnButton();
}

public void addListenerOnButton() {

    final Context context = this;

    button = (Button) findViewById(R.id.main_text_view);

    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            Intent intent = new Intent(context, main.class);
            startActivity(intent);

        }

    });

}
</code></pre>

<p>layout code</p>

<pre><code>&lt;Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/main"
    android:background="@drawable/main"
    android:layout_centerHorizontal="true"
    android:id="@+id/main_text_view"


    android:layout_marginTop="17dp"


    /&gt;
</code></pre>

<p>in this situation </p>

<p>Subactivity button opened sub </p>

<p>but MainActivity button did not open main</p>

<p>but if i put MainActivity above Subactivity </p>

<p>Subactivity button did not open sub </p>

<p>but MainActivity button opened main</p>