title: Passing data with "putExtra" in Recyclerview
body: <p>I want to pass some details data from my model to another activity using class recyclerview adapter.</p>
  
  <p><strong>Adapters's code:</strong></p>
  
  <pre><code>public class Tab1RecyclerAdapter extends 
  RecyclerView.Adapter&lt;Tab1RecyclerAdapter.MyViewHolder&gt; {
  
  private Context context;
  private List&lt;Tab1BookModel&gt; bookList;
  private LayoutInflater inflater;
  
  public Tab1RecyclerAdapter(Context context, List&lt;Tab1BookModel&gt; bookList) {
      inflater = LayoutInflater.from(context);
      this.context = context;
      this.bookList = bookList;
  }
  
  @Override
  public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View view = inflater.inflate(R.layout.book_list_item, parent, false);
      MyViewHolder holder = new MyViewHolder(view);
      return holder;
  }
  
  @Override
  public void onBindViewHolder(MyViewHolder holder, int position) {
      Tab1BookModel book = bookList.get(position);
      holder.setData(book, position);
  }
  
  @Override
  public int getItemCount() {
      return bookList.size();
  }
  
  class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
  
      private ImageView downloadIcon;
      private TextView bookTitle, bookAuthor;
      private View container;
      private int position;
      private Tab1BookModel book;
  
      MyViewHolder(View view) {
          super(view);
          itemView.setOnClickListener(this);
          bookTitle = (TextView) view.findViewById(R.id.book_title);
          bookAuthor = (TextView) view.findViewById(R.id.book_author);
          downloadIcon = (ImageView) view.findViewById(R.id.download_icon);
          //            downloadIcon.setOnClickListener(this);
          container = view.findViewById(R.id.container_book_list_item);
          container.setOnClickListener(this);
      }
  
      void setData(Tab1BookModel book, int position) {
          this.bookTitle.setText(book.getTab1BookTitle());
          this.bookAuthor.setText(book.getTab1BookAuthor());
          this.position = position;
          this.book = book;
      }
  </code></pre>
  
  <p><strong>OnClick method:</strong></p>
  
  <pre><code>    @Override
      public void onClick(View view) 
      {
          int position = getAdapterPosition();
          if (position != RecyclerView.NO_POSITION)
          {
              Intent intent = new Intent(context, BookReaderActivity.class);
              intent.putExtra("content", bookList.get(position).getTab1BookContent());
              intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              context.startActivity(intent);
          }
      }
  }
  
  }
  </code></pre>
  
  <p><strong>Model's code:</strong></p>
  
  <pre><code>public class Tab1BookModel {
  
  private int bookTitle;
  private int bookAuthor;
  private int bookContent;
  
  public int getTab1BookTitle() {
      return bookTitle;
  }
  
  public void setBookTitle(int bookTitle) {
      this.bookTitle = bookTitle;
  }
  
  public int getTab1BookAuthor() {
      return bookAuthor;
  }
  
  public void setBookAuthor(int bookAuthor) {
      this.bookAuthor = bookAuthor;
  }
  
  public int getTab1BookContent() {
      return bookContent;
  }
  
  public void setBookContent(int bookContent) {
      this.bookContent = bookContent;
  }
  
  public static List&lt;Tab1BookModel&gt; getObjectList() {
  
      List&lt;Tab1BookModel&gt; dataList = new ArrayList&lt;&gt;();
      int[] title = getTitle();
      int[] author = getAuthor();
      int[] content = getContent();
  
      for (int i = 0; i &lt; title.length; i++) {
          Tab1BookModel books = new Tab1BookModel();
          books.setBookTitle(title[i]);
          books.setBookAuthor(author[i]);
          books.setBookContent(content[i]);
          dataList.add(books);
      }
      return dataList;
  }
  
  private static int[] getTitle() {
      int[] title = {
              R.string.title_1, R.string.title_2, R.stringtitle_3,
              R.string.title_4, R.string.title_5, R.string.title_6,
              R.string.title_7, R.string.title_8, R.string.title_9
      };
      return title;
  }
  
  private static int[] getAuthor() {
      int[] author = {
              R.string.author_1, R.string.author_2, R.string.author_3,
              R.string.author_4, R.string.author_5, R.string.author_6,
              R.string.author_7, R.string.author_8, R.string.author_9
      };
      return author;
  }
  </code></pre>
  
  <p><strong>List of the data, from which I need to pass one item to another activity:</strong></p>
  
  <pre><code>private static int[] getContent() {
      int[] content = {
              R.string.book_1, R.string.book_2, R.string.book_3,
              R.string.book_4, R.string.book_5, R.string.book_6,
              R.string.book_7, R.string.book_8, R.string.book_9
      };
      return content;
  }
  
  }
  </code></pre>
  
  <p><strong>Activity, in which I want to pass some data:</strong></p>
  
  <pre><code>public class BookReaderActivity extends AppCompatActivity {
  
  TextView bookContent;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_book_reader);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
  
      bookContent = (TextView) findViewById(R.id.book_content);
  
      bookContent.setText(getIntent().getExtras().getString("content"));
  }
  
  }
  </code></pre>