title: I`m Trying To Merge Two Adapter In One Recycler View but when Irun my app the app will be crashed
body: <p><a href="https://i.stack.imgur.com/ITDXk.png" rel="nofollow noreferrer">Here is the logcat error</a>
  <strong>I face some crash issue in my app when I run the app will be crashed, I`m doing two adapter merger in one recycler view at loading time app will be crashed I don't know about why app will be crashed</strong></p>
  <p>I`m Using Latest Recycler view Dependency of androidx :-     implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha02'</p>
  <p>logcat error</p>
  <pre><code> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sti/com.example.sti.testing_activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$Adapter.hasStableIds()' on a null object reference
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3735)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3903)
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2328)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:255)
          at android.app.ActivityThread.main(ActivityThread.java:8212)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView$Adapter.hasStableIds()' on a null object reference
          at androidx.recyclerview.widget.MergeAdapterController.addAdapter(MergeAdapterController.java:151)
          at androidx.recyclerview.widget.MergeAdapterController.addAdapter(MergeAdapterController.java:132)
          at androidx.recyclerview.widget.MergeAdapter.addAdapter(MergeAdapter.java:142)
          at androidx.recyclerview.widget.MergeAdapter.&lt;init&gt;(MergeAdapter.java:125)
          at androidx.recyclerview.widget.MergeAdapter.&lt;init&gt;(MergeAdapter.java:101)
          at androidx.recyclerview.widget.MergeAdapter.&lt;init&gt;(MergeAdapter.java:87)
          at com.example.sti.testing_activity.merger(testing_activity.java:77)
          at com.example.sti.testing_activity.onCreate(testing_activity.java:62)
          at android.app.Activity.performCreate(Activity.java:8151)
          at android.app.Activity.performCreate(Activity.java:8135)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3704)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3903) 
          at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
          at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2328) 
          at android.os.Handler.dispatchMessage(Handler.java:106) 
          at android.os.Looper.loop(Looper.java:255) 
          at android.app.ActivityThread.main(ActivityThread.java:8212) 
          at java.lang.reflect.Method.invoke(Native Method) 
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) 
  2021-11-20 16:01:24.101 784-790/? E/statsd: Predicate 5980654721335871649 dropping data for dimension key (10)0x2010101-&gt;10646[I] (10)0x30000-&gt;*launch*[S] 
  2021-11-20 16:01:24.139 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.140 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.140 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.140 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.163 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.163 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.164 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.164 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.165 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.211 784-790/? E/statsd: Predicate 5980654721335871649 dropping data for dimension key (10)0x2010101-&gt;10166[I] (10)0x30000-&gt;CMWakeLock[S] 
  2021-11-20 16:01:24.227 784-790/? E/statsd: Predicate 5980654721335871649 dropping data for dimension key (10)0x2010101-&gt;10166[I] (10)0x30000-&gt;CMWakeLock[S] 
  2021-11-20 16:01:24.296 2498-2498/? E/Launcher.ColorBubbleTextView: mForceHideDot is false
  2021-11-20 16:01:24.470 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:24.556 845-917/? E/UxUtility: notifyAppState error = NULL
  2021-11-20 16:01:24.577 3243-1764/? E/oiface: packageSwitch pkg com.oppo.launcher, enter
  2021-11-20 16:01:24.578 3243-1764/? E/oiface: current package is com.oppo.launcher and pid is 2498
  2021-11-20 16:01:24.585 3243-3256/? E/oiface: Average freq 1144275 for 12s.
  2021-11-20 16:01:24.586 3243-3256/? E/oiface: Average freq 1265076 for 12s.
  2021-11-20 16:01:24.586 3243-3256/? E/oiface: get gpu config path failed. Fallback to default.
  2021-11-20 16:01:24.586 1653-1666/? E/ORMS_Platform : OplusResourceManagerPlatformUtils: readFile function exception:/sys/devices/platform/soc/5000000.qcom,kgsl-3d0/kgsl/kgsl-3d0/freq_table_mhz: open failed: ENOENT (No such file or directory)
  2021-11-20 16:01:24.586 3243-3256/? E/oiface: get gpu freq table failed
  2021-11-20 16:01:24.589 3243-3256/? E/oiface: client  not found, skipped
  2021-11-20 16:01:24.594 3243-3256/? E/oiface: get gpu config path failed. Fallback to default.
  2021-11-20 16:01:24.595 1653-4015/? E/ORMS_Platform : OplusResourceManagerPlatformUtils: readFile function exception:/sys/devices/platform/soc/5000000.qcom,kgsl-3d0/kgsl/kgsl-3d0/freq_table_mhz: open failed: ENOENT (No such file or directory)
  2021-11-20 16:01:24.595 3243-3256/? E/oiface: get gpu freq table failed
  2021-11-20 16:01:27.040 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:28.304 25110-25139/? E/Parcel: Reading a NULL string not supported here.
  2021-11-20 16:01:29.374 3239-3251/? E/horae: 0: back:36418,frame:34468,front:35954, 6, +(2982), 1 ,36200,40000,39400,39200
  2021-11-20 16:01:29.600 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:30.035 5321-5337/? E/IHansComunication: HANS printMessageBody: RCVed message body: type = 0, port = 86870, caller_pid = 1653, caller_uid = 1000, target_pid = 15035, target_uid = 10266, pkg_cmd = -1
  2021-11-20 16:01:32.159 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:34.075 3243-1764/? E/oiface: Abnormal! com.oppo.launcher[com.oppo.launcher/com.oppo.launcher.Launcher#0] current fps is: 0.000000 abnormal, return 0
  2021-11-20 16:01:34.721 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:37.278 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:39.076 3243-1764/? E/oiface: Abnormal! com.oppo.launcher[com.oppo.launcher/com.oppo.launcher.Launcher#0] current fps is: 0.000000 abnormal, return 0
  2021-11-20 16:01:39.839 2461-2461/? E/OplusNecManagerHelper: com.oplus.nec.OplusNecManager.notifyOrigSignalStrengthChanged [class android.telephony.SignalStrength, int]
  2021-11-20 16:01:41.994 25217-25217/? E/com.truecaller: Unknown bits set in runtime_flags: 0x40000000
  2021-11-20 16:01:42.001 25217-25217/? E/com.truecaller: Not starting debugger since process cannot load the jdwp agent.
  2021-11-20 16:01:42.009 25217-25217/? E/RefClass: java.lang.reflect.InvocationTargetException
  2021-11-20 16:01:42.187 25217-25242/? E/Parcel: Reading a NULL string not supported here.
  2021-11-20 16:01:42.205 25217-25244/? E/Parcel: Reading a NULL string not supported here.
  2021-11-20 16:01:42.512 550-560/? E/cutils: Failed to fstatat(/mnt/media_rw/7C80-0817/Android/data/com.truecaller/cache): I/O error
  2021-11-20 16:01:42.583 25217-25276/? E/Parcel: Reading a NULL string not supported here.
  2021-11-20 16:01:42.608 25217-25244/? E/Parcel: Reading a NULL string not supported here.
  </code></pre>
  <p>here is my code .</p>
  <p>coureseadapter_re.java</p>
  <pre><code>public class coureseadapter_re extends RecyclerView.Adapter&lt;coureseadapter_re.coureseviewholder&gt; {
  
  
      private ArrayList&lt;courseinfo.Blog&gt;blogs;
      private Context context;
    
  
  
      public coureseadapter_re(ArrayList&lt;courseinfo.Blog&gt; blogs, Context context) {
          this.blogs = blogs;
          this.context = context;
  
      }
  
  
      @NonNull
      @Override
      public coureseviewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          LayoutInflater li=LayoutInflater.from(context);
          return  new coureseviewholder(CoureseinfoBinding.inflate(li));
      }
  
      @Override
      public void onBindViewHolder(@NonNull coureseviewholder holder, int position) {
          holder.binding.pointN.setText(blogs.get(position).getPoint());
      }
  
      @Override
      public int getItemCount() {
          return blogs.size();
      }
  
      class coureseviewholder extends RecyclerView.ViewHolder{
  
          CoureseinfoBinding binding;
          coureseviewholder(CoureseinfoBinding c){
              super(c.getRoot());
              binding=c;
          }
      }
  
  }
  </code></pre>
  <p>spinneradapter_re.java</p>
  <pre><code>public class spinneradapter_re extends RecyclerView.Adapter&lt;spinneradapter_re.getdeloperholder&gt;{
  
      private ArrayList&lt;com.example.sti.Models.getdeveloper.Developer&gt; getdevelopers;
      private Context context;
      private getdeveloper deve;
  
  
  
      private ArrayList&lt;String&gt;developerid=new ArrayList&lt;&gt;();
      private ArrayList&lt;String&gt;developername=new ArrayList&lt;&gt;();
  
  
  
      public spinneradapter_re(ArrayList&lt;com.example.sti.Models.getdeveloper.Developer&gt; getdevelopers, Context context) {
          this.getdevelopers=getdevelopers;
          this.context=context;
  
          developername.add(&quot;Select faculty&quot;);
          for (int i=0;i&lt;getdevelopers.size();i++){
              developername.add(getdevelopers.get(i).getName());
              developerid.add(getdevelopers.get(i).getId());
          }
  
      }
  
      @NonNull
      @Override
      public getdeloperholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          LayoutInflater l1=LayoutInflater.from(context);
          return new getdeloperholder(ReSpinnerBinding.inflate(l1));
      }
  
      @Override
      public void onBindViewHolder(@NonNull getdeloperholder holder, int position) {
  
          ArrayAdapter&lt;String&gt; adp = new ArrayAdapter&lt;String&gt; (context,android.R.layout.simple_spinner_dropdown_item,developername);
          adp.setDropDownViewResource(android.R.layout.simple_spinner_item);
          holder.binding.facN.setAdapter(adp);
          holder.binding.facN.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() {
              @Override
              public void onItemSelected(MaterialSpinner view, int position, long id, Object item) {
  
              }
          });
      }
  
      @Override
      public int getItemCount() {
          return getdevelopers.size();
      }
  
      class getdeloperholder extends RecyclerView.ViewHolder {
  
          ReSpinnerBinding binding;
          getdeloperholder(ReSpinnerBinding b){
              super(b.getRoot());
              binding=b;
          }
      }
  }
  </code></pre>
  <p>testing_activity.java</p>
  <pre><code>public class testing_activity extends AppCompatActivity {
  
  
  
      ActivityTestingBinding binding;
      ApiInterface apiInterface;
      private com.example.sti.utils.progresshandler progresshandler;
      private Context context;
      RecyclerView.LayoutManager layoutManager;
      coureseadapter_re re;
      spinneradapter_re spinneradapter_re;
      ArrayList&lt;coureseadapter_re&gt; coureseadapter_res;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          binding=ActivityTestingBinding.inflate(getLayoutInflater());
          setContentView(binding.getRoot());
          layoutManager=new LinearLayoutManager(this);
          binding.recyclerView.setLayoutManager(layoutManager);
          apiInterface= ApiClient.getApiClient().create(ApiInterface.class);
          progresshandler=new progresshandler(this);
  
  
          merger();
          processing();
          spinnerPorcess();
  
  
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          binding=null;
      }
  
      void merger(){
  
          MergeAdapter mergeAdapter=new MergeAdapter(re,spinneradapter_re);
          binding.recyclerView.setAdapter(mergeAdapter);
      }
  
  
      public void processing(){
          progresshandler.show();
          Call&lt;courseinfo&gt; call=apiInterface.getdetails(getIntent().getExtras().getString(&quot;id&quot;));
          call.enqueue(new Callback&lt;courseinfo&gt;() {
              @Override
              public void onResponse(Call&lt;courseinfo&gt; call, Response&lt;courseinfo&gt; response) {
                  courseinfo courseinfo= response.body();
                  Log.i(&quot;response&quot;,courseinfo.getStatus());
                  first_adapter(response.body().getBlogs());
                  progresshandler.hide();
  
              }
  
              @Override
              public void onFailure(Call&lt;courseinfo&gt; call, Throwable t) {
                  progresshandler.hide();
                  Toast.makeText(getApplicationContext(),t.toString(), Toast.LENGTH_SHORT).show();
              }
          });
  
      }
  
  
  
      public void spinnerPorcess(){
          progresshandler.show();
          Call&lt;getdeveloper&gt;call=apiInterface.getdeve(getIntent().getExtras().getString(&quot;id&quot;));
          call.enqueue(new Callback&lt;getdeveloper&gt;() {
              @Override
              public void onResponse(Call&lt;getdeveloper&gt; call, Response&lt;getdeveloper&gt; response) {
                  getdeveloper getdeveloper=response.body();
                  if(response.body()!=null){
                      Log.i(&quot;responsepspin&quot;,getdeveloper.getStatus());
                      second_adapter(response.body().getDeveloper());
                  }
                  else{
                      Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_SHORT).show();
                  }
              }
  
              @Override
              public void onFailure(Call&lt;getdeveloper&gt; call, Throwable t) {
                  Toast.makeText(getApplicationContext(), t.toString(), Toast.LENGTH_SHORT).show();
  
              }
          });
      }
  
  
  
      public void  first_adapter(ArrayList&lt;courseinfo.Blog&gt;blogs){
          re=new coureseadapter_re(blogs,testing_activity.this);
      }
  
      private void second_adapter(ArrayList&lt;getdeveloper.Developer&gt;developers){
          spinneradapter_re=new spinneradapter_re(developers,testing_activity.this);
      }
  }
  </code></pre>