title: Android Studio is it normal for R.id to access every components
body: <p>I am working on a little Android Studio (version 2.2.3) application.</p>
  
  <p>After adding a second activity with a lot of components I noticed that when I type R.id in the first activity, the auto-completion proposes me the components from the second activity.</p>
  
  <p>Is this normal ?</p>
  
  <p><img src="https://i.stack.imgur.com/cTRrV.png" alt="Screenshot resuming my problem"></p>
  
  <p>And here is a working example of my issue (I took the screenshot from it), for simplicity I just created two empty activities each one with a button.</p>
  
  <p>AndroidManifest.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.myapplication"&gt;
  
  &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=".MainActivity"&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=".Main2Activity"&gt;&lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivity.java : </p>
  
  <pre><code>package com.example.myapplication;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.Button;
  
  
  public class MainActivity extends AppCompatActivity {
      private Button btMain1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          //Here is the issue,
          //autocompletion of R.id. shows every layout and their composents
          btMain1 = (Button) findViewById(R.id.); 
      }
  }
  </code></pre>
  
  <p>activity_main.xml : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.myapplication.MainActivity"&gt;
  
  
      &lt;Button
          android:text="Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="198dp"
          android:id="@+id/btMain1" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Main2Activity.java :</p>
  
  <pre><code>package com.example.myapplication;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.widget.Button;
  
  public class Main2Activity extends AppCompatActivity {
      private Button btMain2;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main2);
      }
  }
  </code></pre>
  
  <p>activity_main2.xml : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main2"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.myapplication.Main2Activity"&gt;
  
      &lt;Button
          android:text="Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="198dp"
          android:id="@+id/btMain2" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>