title: Kotlin: Passing object from recyclerview to another fragment to edit when clicked
body: <p>I'm just beginning to learn kotlin and my app is vey basic but this basic functionality has been giving me trouble the past couple of days.</p>
  <p>I have one activity with two fragments (A and B) in my app. Fragment A is used to display the data in recyclerview. Fragment B is used to add data using edit texts/add button etc. That all works fine. Then when user selects an item in the recyclerview in Fragment A I want to navigate back to Fragment B passing an argument to say the user is now editing now adding and populate the edit texts with the selected items fields so the user can edit.</p>
  <p>My Adapter:</p>
  <pre><code>class MoviesAdapter constructor(private var movies: List&lt;MovieModel&gt;)
  : RecyclerView.Adapter&lt;MoviesAdapter.MainHolder&gt;() {
  
  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MainHolder {
      return MainHolder(
          LayoutInflater.from(parent.context).inflate(
              R.layout.card_movie,
              parent,
              false
          )
      )
  }
  
  override fun onBindViewHolder(holder: MainHolder, position: Int) {
      val movie = movies[holder.adapterPosition]
      holder.bind(movie)
  }
  
  override fun getItemCount(): Int = movies.size
  
  class MainHolder constructor(itemView: View) : RecyclerView.ViewHolder(itemView) {
  
      fun bind(movie: MovieModel) {
          itemView.movie_view_Title.text = movie.title
          itemView.movie_view_director.text = movie.director
          itemView.movie_view_releaseDate.text = movie.releaseDate.toString()
          itemView.movie_view_ratingBar.rating = movie.rating.toFloat()
          itemView.movie_view_Image.setImageBitmap(readImageFromPath(itemView.context,movie.image))
  
          itemView.setOnClickListener{
          //Pass the movie item to Fragment B to edit &amp; pass argument to say we are editing not adding
          }
      }
  }
    }
  </code></pre>