title: How to receive Parcelable object parameters in separate activity?
body: <p>I would like to be able to receive the individual parameters of my paracable object in the next activity. I believe that I am using the correct method, just do not understand how to output the parameter inputs once in the second activity.</p>
  
  <p>My MainActivty.kt:</p>
  
  <pre><code>package com.example.favouritefood
  
  import android.content.Intent
  import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.widget.ImageButton
  
  class MainActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          val food1: ImageButton = findViewById(R.id.imageButtonFood1)
          val food2: ImageButton = findViewById(R.id.imageButtonFood2)
          val food3: ImageButton = findViewById(R.id.imageButtonFood3)
          val food4: ImageButton = findViewById(R.id.imageButtonFood4)
  
          val pizza = Food(
                  "Pizza", "www.test.com", "Italy, Tomato",
                  "1/1/2018", "pizza@mail.com", 5)
  
          food1.setOnClickListener()
          {
              val intent = Intent(this, MetaDataActivity::class.java).apply {
                  putExtra("Food", pizza)
              }
              startActivity(intent)
          }
      }
  }
  </code></pre>
  
  <p>My second activity (to receive the parcelable):</p>
  
  <pre><code>package com.example.favouritefood
  
  import android.support.v7.app.AppCompatActivity
  import android.os.Bundle
  import android.os.Parcelable
  import android.widget.EditText
  
  class MetaDataActivity : AppCompatActivity() {
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_meta_data)
  
          val name: EditText = findViewById(R.id.editTextName)
  
          val food = intent.getParcelableExtra("Food") as Parcelable
  
          val test = food.writeToParcel(food, 0)
  
          name.setText(test.toString())
      }
  }
  </code></pre>
  
  <p>Where <code>food.wrtieToParcel(food, 0)</code> throws a type mismatch of Required: Parcel! Found: Parcelable over <code>food</code>.</p>
  
  <p>How would I go about reading the parameters in the object?</p>
  
  <p>My object class for reference:</p>
  
  <pre><code>package com.example.favouritefood
  
  import android.os.Parcel
  import android.os.Parcelable
  
  class Food(val name: String?, val location: String?, val keywords: String?, val date: String?, val email: String?, val rating: Int) : Parcelable {
      constructor(parcel: Parcel) : this(
              parcel.readString(),
              parcel.readString(),
              parcel.readString(),
              parcel.readString(),
              parcel.readString(),
              parcel.readInt()) {
      }
  
      override fun writeToParcel(parcel: Parcel, flags: Int) {
          parcel.writeString(name)
          parcel.writeString(location)
          parcel.writeString(keywords)
          parcel.writeString(date)
          parcel.writeString(email)
          parcel.writeInt(rating)
      }
  
      override fun describeContents(): Int {
          return 0
      }
  
      companion object CREATOR : Parcelable.Creator&lt;Food&gt; {
          override fun createFromParcel(parcel: Parcel): Food {
              return Food(parcel)
          }
  
          override fun newArray(size: Int): Array&lt;Food?&gt; {
              return arrayOfNulls(size)
          }
      }
  }
  </code></pre>