title: Pass data between fragments in kotlin android studio
body: <p>I want to pass some data from PowerofMind to wishlist fragment but I encountered with some error.</p>
  
  <p>This Activity from where data has to be transferred</p>
  
  <pre><code>      wish?.setOnClickListener({
              val name = "Power of Subconcoius Mind"
              val intent = Intent(this@PowerofMind, WishlistFragment::class.java)
              intent.putExtra("Book: ", name)
              startActivity(intent)
              Toast.makeText(this, "Added to WishList", Toast.LENGTH_SHORT).show()
          })
  </code></pre>
  
  <p>I want to show data in this activity as</p>
  
  <pre><code>
  
  class WishlistFragment : Fragment() {
      var result: TextView? = null
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
          val view = inflater.inflate(R.layout.fragment_wishlist, null)
          result =view.findViewById(R.id.list1)
          val name = activity?.intent?.getStringExtra("Book: ")
          list1.text = "Book: $name"
          return view
      }
  }
  
  </code></pre>
  
  <p>But there is an error on Intent. Please Help</p>