title: Android RecyclerView "cannot find symbol variable"
body: <p>My problem is that I am writing a program which contains 2 RecyclerViews in 2 different activities. The first one worked like a charm.  No troubles at all. The second one, on the other hand, is not working. It should be exactly the same situation, I'm doing exactly the same thing but I just can't get rid of the error.</p>
  
  <p><a href="https://i.stack.imgur.com/YBF4Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YBF4Y.png" alt="enter image description here"></a></p>
  
  <p>For now, I'll just provide my Activity Class, My Adapter and my corresponding XML File.</p>
  
  <p>The bold part in the following methods also spit out a "Cannot resolve symbol" and I guess it has to do with the problem above but when I try to run the app only the error above gets shown.</p>
  
  <pre><code>binding.listItem.**setAdapter**(adapter);
  binding.listItem.**setLayoutManager**(new LinearLayoutManager(this));
  </code></pre>
  
  <p>Adapter:</p>
  
  <pre><code>public class UserAdapter extends RecyclerView.Adapter&lt;UserAdapter.ViewHolder&gt; {
  
  private List&lt;User&gt; users;
  private Context context;
  
  public UserAdapter(List&lt;User&gt; users, Context context) {
      this.users = users;
      this.context = context;
  }
  
  @NonNull
  @Override
  public UserAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
      SubmitListItemBinding binding = DataBindingUtil
              .inflate(LayoutInflater.from(viewGroup.getContext()),
                      R.layout.submit_list_item,
                      viewGroup,
                      false);
      return new ViewHolder(binding);
  }
  
  @Override
  public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
      User user = users.get(i);
      viewHolder.submitListItemBinding.setUser(user);
  }
  
  @Override
  public int getItemCount() {
      return users.size();
  }
  
  public class ViewHolder extends RecyclerView.ViewHolder {
      public SubmitListItemBinding submitListItemBinding;
  
      public ViewHolder(@NonNull SubmitListItemBinding binding) {
          super(binding.getRoot());
          submitListItemBinding = binding;
      }
  }
  }
  </code></pre>
  
  <p>Activity:</p>
  
  <pre><code>public class SubmitLayout extends AppCompatActivity {
  private UserAdapter adapter;
  private SubmitListItemBinding binding;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_submit_layout_);
  
      Intent intent = getIntent();
      String s = intent.getStringExtra("group");
  
      Group group = new Gson().fromJson(s, Group.class);
      List&lt;User&gt; users = group.getAllUsers();
  
      binding  = DataBindingUtil.setContentView(this, R.layout.submit_list_item);
      adapter = new UserAdapter(users, this);
  
      binding.listItem.setAdapter(adapter);
      binding.listItem.setLayoutManager(new LinearLayoutManager(this));
  
  }
  }
  </code></pre>
  
  <p>XML Activity Layout: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"&gt;
  &lt;data&gt;
      &lt;variable
          name="user"
          type="com.hasenbau.gemeinschaftskasse_android.model.User"/&gt;
  &lt;/data&gt;
  &lt;android.support.constraint.ConstraintLayout
      android:id="@+id/layoutSubmit"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/white"
      tools:context=".SubmitLayout"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/listItem"
          android:scrollbars="vertical"
          android:layout_width="0dp"
          android:layout_height="0dp"
          android:layout_marginStart="16dp"
          android:layout_marginTop="16dp"
          android:layout_marginEnd="16dp"
          android:layout_marginBottom="16dp"
          android:background="@color/colorAccent"
          android:padding="16dp"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent" /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <p>And finally the ListItem XML: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"&gt;
      &lt;data&gt;
      &lt;variable
          name="user"
          type="com.hasenbau.gemeinschaftskasse_android.model.User"/&gt;
      &lt;/data&gt;
      &lt;LinearLayout
      android:id="@+id/list_view"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:paddingTop="8dp"
      android:paddingBottom="8dp"&gt;
  
      &lt;TextView
          android:id="@+id/whoListItemTextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          tools:text="Marv"
          android:text="@{String.valueOf(user.name)}"
          android:textAlignment="center"
          android:textColor="@color/Darkblue"
          android:textSize="20sp" /&gt;
  
      &lt;TextView
          android:id="@+id/howMuchListItemTextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          tools:text="bezahlen"
          android:text="bezahlen"
          android:textAlignment="center"
          android:textColor="@color/Darkblue"
          android:textSize="20sp" /&gt;
  
      &lt;TextView
          android:id="@+id/whatForListItemTextView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          tools:text="100€"
          android:text="@{String.valueOf(user.balance)}"
          android:textAlignment="center"
          android:textColor="@color/Darkblue"
          android:textSize="20sp" /&gt;
  &lt;/LinearLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  
  <h2>Update</h2>
  
  <p>After trying to invalidate cache I go this IDE Error :</p>
  
  <pre><code>java.lang.Throwable
  at com.intellij.psi.impl.DebugUtil.startPsiModification(DebugUtil.java:512)
  at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:542)
  at com.intellij.psi.impl.file.impl.FileManagerImpl.processFileTypesChanged(FileManagerImpl.java:268)
  at com.intellij.psi.impl.file.impl.FileManagerImpl$1.exitDumbMode(FileManagerImpl.java:89)
  at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
  at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:426)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:387)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:376)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:364)
  at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:355)
  at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:43)
  at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:208)
  at com.sun.proxy.$Proxy51.modificationCountChanged(Unknown Source)
  at com.intellij.psi.impl.PsiModificationTrackerImpl.fireEvent(PsiModificationTrackerImpl.java:93)
  at com.intellij.psi.impl.PsiModificationTrackerImpl.incCountersInner(PsiModificationTrackerImpl.java:100)
  at com.intellij.psi.impl.PsiModificationTrackerImpl.incCounter(PsiModificationTrackerImpl.java:84)
  at com.intellij.psi.impl.PsiModificationTrackerImpl$1.lambda$doIncCounter$0(PsiModificationTrackerImpl.java:68)
  at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1010)
  at com.intellij.psi.impl.PsiModificationTrackerImpl$1.doIncCounter(PsiModificationTrackerImpl.java:68)
  at com.intellij.psi.impl.PsiModificationTrackerImpl$1.exitDumbMode(PsiModificationTrackerImpl.java:78)
  at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
  at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:426)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:387)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:376)
  at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:364)
  at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:357)
  at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:43)
  at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:208)
  at com.sun.proxy.$Proxy92.exitDumbMode(Unknown Source)
  at com.intellij.openapi.project.DumbServiceImpl.updateFinished(DumbServiceImpl.java:344)
  at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
  at com.intellij.openapi.application.TransactionGuardImpl.lambda$pollQueueLater$0(TransactionGuardImpl.java:74)
  at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
  at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
  at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
  at java.awt.EventQueue.access$500(EventQueue.java:98)
  at java.awt.EventQueue$3.run(EventQueue.java:715)
  at java.awt.EventQueue$3.run(EventQueue.java:709)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
  at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
  at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
  at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
  </code></pre>