title: NullPointerException: Attempt to invoke interface method 'java.lang.Object[] java.util.Collection.toArray()' on a null object reference
body: <p>Help me fix this error</p>
  
  <p>Here's my logcat</p>
  
  <blockquote>
    <p>NullPointerException: Attempt to invoke interface method
    'java.lang.Object[] java.util.Collection.toArray()' on a null object
    reference
    --->membersList.addAll (member);</p>
  </blockquote>
  
  <p>I tried to initialize and tried several times but it was no use. Please help me solve this problem.</p>
  
  <pre><code>10-14 16:11:09.995 31885-31885/com.designzoos.indj E/UncaughtException: java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.
                                                                          at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:111)
                                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:148)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5551)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
                                                                       Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object[] java.util.Collection.toArray()' on a null object reference
                                                                          at java.util.ArrayList.addAll(ArrayList.java:188)
                                                                          at com.designzoos.indj.presentation.view.adapter.ChooseArtistAdapter.&lt;init&gt;(ChooseArtistAdapter.java:72)
                                                                          at com.designzoos.indj.presentation.view.activity.ChooseArtistActivity.showMembersData(ChooseArtistActivity.java:155)
                                                                          at com.designzoos.indj.presentation.presenter.PostArtistPresenter$MembersLikeDataObserver.onNext(PostArtistPresenter.java:75)
                                                                          at com.designzoos.indj.presentation.presenter.PostArtistPresenter$MembersLikeDataObserver.onNext(PostArtistPresenter.java:54)
                                                                          at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:198)
                                                                          at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:250)
                                                                          at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
                                                                          at android.os.Handler.handleCallback(Handler.java:739) 
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                          at android.os.Looper.loop(Looper.java:148) 
                                                                          at android.app.ActivityThread.main(ActivityThread.java:5551) 
                                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) 
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 
  </code></pre>
  
  <p>Here is my adapter<br>
  (ChooseArtistAdapter.java:72) --->membersList.addAll(member);</p>
  
  <pre><code>public class ChooseArtistAdapter extends RecyclerView.Adapter&lt;ChooseArtistAdapter.ViewHolder&gt; implements Filterable,SearchView {
  private ArrayList&lt;Members&gt;member = new ArrayList&lt;&gt;();
  private ArrayList&lt;Members&gt;membersList;
  private RecordFilter filter;
  Context mContext;
  @Inject
  PostArtistPresenter postArtistPresenter;
  
  public ChooseArtistAdapter(Context context, ArrayList&lt;Members&gt; member) {
  
  //        if(member==null)return;
      this.mContext = context;
      this.membersList = new ArrayList&lt;&gt;();
      this.member = member;
      **membersList.addAll(member);**
  
  }
  
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_artist_adapter, parent, false);
  
      return new ViewHolder(view);
  }
  
  @Override
  public void onBindViewHolder( final ViewHolder holder,  int position) {
      final Members members = membersList.get(position);
      holder.artistName.setText(members.getName());
  //        if(){
  //            holder.artistName.setText(members.getName());
  //        }else if(){
  //            holder.artistName.setText(members.getGroup()+" 
   "+members.getName());
  //        }
      Glide.with(mContext)
              .load(members.getImageUrl()).listener(new 
   RequestListener&lt;Drawable&gt;() {
          @Override
          public boolean onLoadFailed(@Nullable GlideException e, Object model, Target&lt;Drawable&gt; target, boolean isFirstResource) {
              return false;
          }
  
          @Override
          public boolean onResourceReady(Drawable resource, Object model, Target&lt;Drawable&gt; target, DataSource dataSource, boolean isFirstResource) {
              holder.imageViewPlaceHolder.setVisibility(View.GONE);
              return false;
          }
      })
              .into(holder.artist_image_cover);
  
      holder.setItemClickListener(new ItemClickListener() {
          boolean isSelectClick=true;
          int count =0;
          @Override
          public void onClick(View view, int position) {
              Context context = view.getContext();
  
              if(isSelectClick==true){
                  holder.selectImage.setVisibility(View.VISIBLE);
                  isSelectClick=false;
                  count=1;
                  //post
                      ((ChooseArtistActivity) context).postPresenter();
  
  
              }else if(isSelectClick==false){
                  holder.selectImage.setVisibility(View.GONE);
                  isSelectClick=true;
                  count=-1;
                  //delete
                      ((ChooseArtistActivity) context).deletePresenter();
  
  
              }
              ((ChooseArtistActivity)context).setCountText(count);
  
          }
      });
  }
  
  @Override
  public int getItemCount() {
      if (null == membersList)
      {
          return 0;
      }else{
          return membersList.size();
      }
  }
  
  
  
  
  public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
      @Nullable
      @BindView(R.id.imageViewPlaceHolder)
      CircularImageView imageViewPlaceHolder;
  
      @Nullable
      @BindView(R.id.artist_image_cover)
      CircularImageView artist_image_cover;
  
      @Nullable
      @BindView(R.id.selectImage)
      public
      CircularImageView selectImage;
  
      @BindView(R.id.artistName)
      TextView artistName;
  
      @Nullable
      @BindView(R.id.check)
      public TextView check;
      private ItemClickListener itemClickListener;
      private ChooseArtistActivity chooseArtistActivity;
  
  
  
      public ViewHolder(View itemView) {
          super(itemView);
          ButterKnife.bind(this, itemView);
  
          itemView.setOnClickListener(this);
          //onClick
      }
  
      public void setItemClickListener(ItemClickListener itemClickListener){
          this.itemClickListener = itemClickListener;
      }
      @Override
      public void onClick(View view) {
          itemClickListener.onClick(view,getAdapterPosition());
      }
  }
  </code></pre>