title: How to send data using interface
body: <p>I would like to make simple example of sending data via interface from Fragment to another class or from Fragment to activity.</p>
  <p>SendData.kt</p>
  <pre><code>interface SendData {
      fun sendData(text: String)
  }
  </code></pre>
  <p>BlankFragment.kt</p>
  <pre><code>class BlankFragment(val communicator: SendData) : Fragment() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
      }
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment_blank, container, false)
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          communicator.sendData(&quot;testStringToSend&quot;)
      }
  }
  </code></pre>
  <p>ReceiverClass.kt</p>
  <pre><code>class ReceiverClass : SendData {
      override fun sendData(text: String) {
          Log.d(&quot;myString&quot;, text + &quot;DATA&quot;)
      }
  }
  </code></pre>
  <p>MainActivity.kt</p>
  <pre><code>class MainActivity : AppCompatActivity(), SendData {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          val receiverClass = ReceiverClass()
  
          receiverClass.let {
              Log.d(&quot;myString&quot;,  &quot;DATAActivity&quot;)
          }
      }
  
      override fun sendData(text: String) {
          Log.d(&quot;myString&quot;, text + &quot;DATAActivity&quot;)
      }
  }
  </code></pre>
  <p>Unfortunately it doesn't work, do you know how to improve this code?
  IMO, everything should be alright.</p>