title: Attempt to invoke interface method on a null object reference in Adapter AndroidStudio
body: <p>I am trying to make a Fragment which is going to show me the News from RSS channel. I am using a RecyclerView with CardView. My program shows the list of news correct, but when i click on one of this news i recieve this error:</p>
  <blockquote>
  <p>java.lang.NullPointerException: Attempt to invoke interface method 'void com.example.myapplication.Model.ItemClickListener.onClick(android.view.View, int, boolean)' on a null object reference
  at com.example.myapplication.Model.FeedViewHolder.onClick(FeedAdapter.java:38)</p>
  </blockquote>
  <p>My code (FeedAdapter.java):</p>
  <pre><code>package com.example.myapplication.Model;
  
  import android.content.Context;
  import android.content.Intent;
  import android.net.Uri;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import androidx.annotation.NonNull;
  import androidx.recyclerview.widget.RecyclerView;
  
  import com.example.myapplication.R;
  
  class FeedViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
  
  
      public TextView txtTitle, txtPubDate, txtContent;
      private ItemClickListener itemClickListener;
  
      public FeedViewHolder(View itemView) {
          super(itemView);
          txtTitle = (TextView)itemView.findViewById(R.id.txtTitle);
          txtPubDate = (TextView)itemView.findViewById(R.id.txtPubDate);
          txtContent = (TextView)itemView.findViewById(R.id.txtContent);
  
          itemView.setOnClickListener(this);
          itemView.setOnLongClickListener(this);
      }
  
      public void setItemClickListener(ItemClickListener itemClickListener) {
          this.itemClickListener = itemClickListener;
      }
  
      @Override
      public void onClick(View v) {
          itemClickListener.onClick(v, getBindingAdapterPosition(), false);
      }
  
      @Override
      public boolean onLongClick(View v) {
          itemClickListener.onClick(v, getBindingAdapterPosition(), true);
          return true;
      }
  }
  
  public class FeedAdapter extends RecyclerView.Adapter&lt;FeedViewHolder&gt;{
  
      private RSSObject rssObject;
      private Context mContext;
      private LayoutInflater inflater;
  
      public FeedAdapter(RSSObject rssObject, Context mContext) {
          this.rssObject = rssObject;
          this.mContext = mContext;
          inflater = LayoutInflater.from(mContext);
  
      }
  
      @NonNull
      @Override
      public FeedViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View itemView = inflater.inflate(R.layout.row, parent, false);
          return new FeedViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(@NonNull FeedViewHolder holder, int position) {
          holder.txtTitle.setText(rssObject.getItems().get(position).getTitle());
          holder.txtPubDate.setText(rssObject.getItems().get(position).getPubDate());
          holder.txtContent.setText(rssObject.getItems().get(position).getContent());
  
          Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(rssObject.getItems().get(position).getLink()));
          browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          mContext.startActivity(browserIntent);
      }
  
      @Override
      public int getItemCount() {
          return rssObject.items.size();
      }
  }
  </code></pre>
  <p>In my dreams, after clicking on a Row object, browser should open the current news page. But i don't know what to do. Thanks!</p>