title: Recyclerview multi view items with button
body: <p>I want to create a multi-view on Recylcerview by clicking the button(different view for each button). how to write code in Adapter Class or Condition to view it differently.</p>
  <p>this is my code.
  Adapter Class</p>
  <p>public class TripAdapter extends RecyclerView.Adapter&lt;TripAdapter.TripHolderOne&gt; {
  private List trips = new ArrayList&lt;&gt;();</p>
  <pre><code>@NonNull
  @Override
  public TripHolderOne onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
      View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.trip_item, parent, false);
  
      return new TripHolderOne(itemView);
  
  }
  
  @Override
  public int getItemViewType(int position) {
      return super.getItemViewType(position);
  }
  
  @Override
  public void onBindViewHolder(@NonNull TripHolderOne holder, int position) {
      Trip currentTrip = trips.get(position);
      holder.textViewTripTitle.setText(currentTrip.getTripTitle());
      holder.textViewDescription.setText(currentTrip.getDescription());
      holder.textViewPriority.setText(String.valueOf(currentTrip.getPriority()));
      holder.textViewStartDateTime.setText(currentTrip.getStartDateTime());
  
  }
  
  
  @Override
  public int getItemCount() {
      return trips.size();
  }
  
  public void setTrips(List&lt;Trip&gt; trips) {
      this.trips = trips;
      notifyDataSetChanged();
  }
  
  public Trip getTripAt(int position) {
      return trips.get(position);
  }
  
  
  class TripHolderOne extends RecyclerView.ViewHolder {
      private TextView textViewTripTitle;
      private TextView textViewDescription;
      private TextView textViewPriority;
      private TextView textViewStartDateTime;
  
      public TripHolderOne(@NonNull View itemView) {
          super(itemView);
          textViewTripTitle = itemView.findViewById(R.id.text_view_title);
          textViewDescription = itemView.findViewById(R.id.text_view_description);
          textViewPriority = itemView.findViewById(R.id.text_view_priority);
          textViewStartDateTime = itemView.findViewById(R.id.text_view_start_date_time);
  
  
      }
  }
  </code></pre>
  <p>MainActivity Class</p>
  <pre><code>    RecyclerView recyclerView = findViewById(R.id.recycler_view);
      recyclerView.setLayoutManager(new LinearLayoutManager(this));
      recyclerView.setHasFixedSize(true);
      final TripAdapter adapter = new TripAdapter();
      recyclerView.setAdapter(adapter);
      tripViewModel = new ViewModelProvider(this, ViewModelProvider.AndroidViewModelFactory.getInstance(this.getApplication())).get(TripViewModel.class);
      tripViewModel.getAllTrips().observe(this, new Observer&lt;List&lt;Trip&gt;&gt;() {
          @Override
          public void onChanged(@Nullable List&lt;Trip&gt; trips) {
              adapter.setTrips(trips);
          }
      });
  </code></pre>
  <p>And inside MainActivity also have function onActivityResult.</p>
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == ADD_TRANSPORTATION &amp;&amp; resultCode == Activity.RESULT_OK){
          String title = data.getStringExtra(AddTripActivity.EXTRA_TITLE);
          String description = data.getStringExtra(AddTripActivity.EXTRA_DESCRIPTION);
          int priority = data.getIntExtra(AddTripActivity.EXTRA_PRIORITY, 1);
          String startDate = data.getStringExtra(AddTripActivity.EXTRA_START_DATE);
          String startTime = data.getStringExtra(AddTripActivity.EXTRA_START_TIME);
          String startDateTime = data.getStringExtra(AddTripActivity.EXTRA_START_DATE_TIME);
          Log.d(&quot;TAG&quot;, &quot;Text from MainActivity2&quot; + data.getStringExtra(&quot;text&quot;));
  
  
          Trip trip = new Trip(title, description, priority, startDate,startTime,startDateTime);
          tripViewModel.insert(trip);
  
          Toast.makeText(this, &quot;trip saved&quot;, Toast.LENGTH_SHORT).show();
       
      }
  </code></pre>