title: Binary XML file line #26: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{a9ab2d5 VFED
body: <p>I Create Recyclerview on android studio use Kotlin programing language, when I run my code I Get Error. This is the Error I'm getting</p>
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.its*******.*******, PID: 18742
      java.lang.RuntimeException: Unable to start activity ComponentInfo{******************************}: android.view.InflateException: Binary XML file line #26: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{a9ab2d5 VFED..... ......I. 0,0-0,0 #7f080187 app:id/reyclerview_message_list}, adapter:null, layout:null, context:com.its*******.*******.******@36b9430
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3191)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3328)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2054)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:233)
          at android.app.ActivityThread.main(ActivityThread.java:7225)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
       Caused by: android.view.InflateException: Binary XML file line #26: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{a9ab2d5 VFED..... ......I. 0,0-0,0 #7f080187 app:id/reyclerview_message_list}, adapter:null, layout:null, context:com.itsshyam640.cooltalks.userChat@36b9430
       Caused by: java.lang.IllegalStateException: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{a9ab2d5 VFED..... ......I. 0,0-0,0 #7f080187 app:id/reyclerview_message_list}, adapter:null, layout:null, context:com.its*******.*******.*****@36b9430
          at androidx.recyclerview.widget.RecyclerView.generateLayoutParams(RecyclerView.java:4514)
          at android.view.LayoutInflater.rInflate(LayoutInflater.java:902)
          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:861)
          at android.view.LayoutInflater.rInflate(LayoutInflater.java:903)
          at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:861)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
          at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
          at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
          at com.its*******.*******.*****.onCreate(userChat.java:35)
          at android.app.Activity.performCreate(Activity.java:7378)
          at android.app.Activity.performCreate(Activity.java:7369)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3171)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3328)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2054)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:233)
          at android.app.ActivityThread.main(ActivityThread.java:7225)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
  </code></pre>
  <p>This is my mainfile code I had sent the required code only as per the requirements</p>
  <pre><code>public class userChat extends AppCompatActivity {
      private RecyclerView recyclerView_message_list;
      private ArrayList&lt;userChatModel&gt; userChatModels = new ArrayList&lt;&gt;();
      FirebaseDatabase database;
      FirebaseAuth auth;
      @Override
  
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_user_chat);
          getSupportActionBar().hide();
  
          database = FirebaseDatabase.getInstance();
          auth = FirebaseAuth.getInstance();
  
  
          String senderId = auth.getUid();
          String recievedId = getIntent().getStringExtra(&quot;userId&quot;);
          String userName = getIntent().getStringExtra(&quot;userName&quot;);
          String userProfileImage = getIntent().getStringExtra(&quot;userProfileImage&quot;);
  
          TextView username = findViewById(R.id.top_username);
          username.setText(userName);
          Picasso.get().load(userProfileImage).placeholder(R.drawable.user).into((ImageView) findViewById(R.id.user_profile));
  
          findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent intent = new Intent(userChat.this,MainActivity.class);
                  startActivity(intent);
              }
          });
  
  
          recyclerView_message_list = (RecyclerView) findViewById(R.id.recyclerView_message_list);
          final userChatAdapter userChatAdapter = new userChatAdapter(userChatModels,this);
          recyclerView_message_list.setAdapter(userChatAdapter);
  
          LinearLayoutManager layoutManager = new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false);
          recyclerView_message_list.setLayoutManager(layoutManager);
  
  
  
          final String senderMessages = senderId + recievedId;
          final String recieverMessages = recievedId + senderId;
  
          database.getReference().child(&quot;Chats&quot;).child(senderMessages).addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot snapshot) {
                  userChatModels.clear();
                  for(DataSnapshot snapshot1 : snapshot.getChildren()){
                      userChatModel userChatModel = snapshot1.getValue(userChatModel.class);
                      userChatModels.add(userChatModel);
                  }
                  userChatAdapter.notifyDataSetChanged();
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError error) {
  
              }
          });
  </code></pre>
  <p>Here is my xml Code</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:background=&quot;@color/backgroundColor&quot;
      tools:context=&quot;.userChat&quot;&gt;
  
      &lt;androidx.appcompat.widget.Toolbar
          android:id=&quot;@+id/user_chat_toolbar&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:background=&quot;?attr/colorPrimary&quot;
          android:elevation=&quot;30dp&quot;
          android:minHeight=&quot;?attr/actionBarSize&quot;
          android:theme=&quot;?attr/actionBarTheme&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintHorizontal_bias=&quot;0.0&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
          &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&quot;
              tools:layout_editor_absoluteX=&quot;16dp&quot;&gt;
  
  
              &lt;de.hdodenhof.circleimageview.CircleImageView
                  android:id=&quot;@+id/back_button&quot;
                  android:layout_width=&quot;50dp&quot;
                  android:layout_height=&quot;50dp&quot;
                  android:background=&quot;@drawable/round_gradient&quot;
                  android:src=&quot;@drawable/ic_keyboard_backspace_black_24dp&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                  app:layout_constraintStart_toStartOf=&quot;parent&quot;
                  app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
              &lt;de.hdodenhof.circleimageview.CircleImageView
                  android:id=&quot;@+id/user_profile&quot;
                  android:layout_width=&quot;50dp&quot;
                  android:layout_height=&quot;50dp&quot;
                  android:layout_margin=&quot;5dp&quot;
                  android:contentDescription=&quot;@string/profile_image&quot;
                  android:src=&quot;@drawable/user&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;@id/back_button&quot;
                  app:layout_constraintStart_toEndOf=&quot;@id/back_button&quot;
                  app:layout_constraintTop_toTopOf=&quot;@id/back_button&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/top_username&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_marginStart=&quot;8dp&quot;
                  android:layout_marginLeft=&quot;8dp&quot;
                  android:text=&quot;@string/username&quot;
                  android:textColor=&quot;@color/textColor&quot;
                  app:layout_constraintStart_toEndOf=&quot;@+id/user_profile&quot;
                  app:layout_constraintTop_toTopOf=&quot;@+id/user_profile&quot; /&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/audioCall&quot;
                  android:layout_width=&quot;40dp&quot;
                  android:layout_height=&quot;40dp&quot;
                  android:layout_margin=&quot;5dp&quot;
                  android:contentDescription=&quot;@string/audio_call_image&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;@+id/videoCall&quot;
                  app:layout_constraintEnd_toStartOf=&quot;@+id/videoCall&quot;
                  app:layout_constraintTop_toTopOf=&quot;@+id/videoCall&quot;
                  app:srcCompat=&quot;@android:drawable/stat_sys_phone_call_forward&quot; /&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/videoCall&quot;
                  android:layout_width=&quot;40dp&quot;
                  android:layout_height=&quot;40dp&quot;
                  android:layout_margin=&quot;5dp&quot;
                  android:contentDescription=&quot;@string/video_call_image&quot;
                  android:src=&quot;@drawable/camera_pattern&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;@+id/more_actions&quot;
                  app:layout_constraintEnd_toStartOf=&quot;@+id/more_actions&quot;
                  app:layout_constraintTop_toTopOf=&quot;@+id/more_actions&quot; /&gt;
  
              &lt;ImageView
                  android:id=&quot;@+id/more_actions&quot;
                  android:layout_width=&quot;40dp&quot;
                  android:layout_height=&quot;40dp&quot;
                  android:layout_margin=&quot;5dp&quot;
                  android:contentDescription=&quot;@string/more_action_image&quot;
                  android:src=&quot;@drawable/ic_more_vert_black_24dp&quot;
                  app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
                  app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                  app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
      &lt;/androidx.appcompat.widget.Toolbar&gt;
  
      &lt;LinearLayout
          android:layout_height=&quot;match_parent&quot;
          android:layout_width=&quot;match_parent&quot;
          android:orientation=&quot;vertical&quot;&gt;
  
          &lt;androidx.recyclerview.widget.RecyclerView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:id=&quot;@+id/recyclerView_message_list&quot; /&gt;
      &lt;/LinearLayout&gt;
  </code></pre>
  <p>Here is my userChat Adapter Code</p>
  <pre><code>public class userChatAdapter extends RecyclerView.Adapter{
  
      ArrayList&lt;userChatModel&gt; messageModels;
      Context context;
      int SENDER_VIEW_TYPE = 1;
      int RECIEVER_VIEW_TYPE = 2;
  
      public userChatAdapter(ArrayList&lt;userChatModel&gt; messageModels, Context context) {
          this.messageModels = messageModels;
          this.context = context;
      }
  
      @NonNull
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          if(viewType == SENDER_VIEW_TYPE){
              View view = LayoutInflater.from(context).inflate(R.layout.message_sent_layout,parent,false);
              return new senderViewHolder(view);
          }else {
              View view = LayoutInflater.from(context).inflate(R.layout.message_recieved_layout,parent,false);
              return new recieverViewHolder(view);
          }
      }
  
      @Override
      public int getItemViewType(int position) {
          if (messageModels.get(position).getUserId().equals(FirebaseAuth.getInstance().getCurrentUser())){
              return SENDER_VIEW_TYPE;
          }else {
              return RECIEVER_VIEW_TYPE;
          }
      }
  
      @Override
      public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
          userChatModel messageModel = messageModels.get(position);
  
          if(holder.getClass() == senderViewHolder.class){
              ((senderViewHolder)holder).senderMessage.setText(messageModel.getUserMessage());
          }else {
              ((recieverViewHolder)holder).recieverMessage.setText(messageModel.getUserMessage());
          }
      }
  
      @Override
      public int getItemCount() {
          return messageModels.size();
      }
  
      public class recieverViewHolder extends RecyclerView.ViewHolder{
  
          TextView recieverMessage, recieverTime;
  
          public recieverViewHolder(@NonNull View itemView) {
              super(itemView);
  
              recieverMessage = itemView.findViewById(R.id.user_recieved_message);
              recieverTime = itemView.findViewById(R.id.user_recieved_message_time);
          }
      }
  
      public class senderViewHolder extends RecyclerView.ViewHolder{
  
          TextView senderMessage, senderTime;
          public senderViewHolder(@NonNull View itemView) {
              super(itemView);
  
              senderMessage = itemView.findViewById(R.id.user_sent_message);
              senderTime = itemView.findViewById(R.id.user_sent_message_time);
          }
      }
  }
  </code></pre>
  <p>I tried many ways but could not resolve the error.... I had applied many stackoverflow solutions.</p>
  <p>Thanks in Advance!</p>