Android Kotlin create class implement Parcelable give an error in 'override' of writeToParcel method

前端 未结 2 699
走了就别回头了
走了就别回头了 2020-12-31 07:29

To use Parcelable, I had followed this release of Kotlin 1.1.4 : https://blog.jetbrains.com/kotlin/2017/08/kotlin-1-1-4-is-out/

Add this line in project



        
2条回答
  •  生来不讨喜
    2020-12-31 08:20

    You can safely just ignore the warning as it's only lint check.
    for now to get rid of it just use @SuppressLint("ParcelCreator")

    ex:

    @SuppressLint("ParcelCreator")
    @Parcelize
    class User(val firstName: String, val lastName: String) : Parcelable
    

提交回复
热议问题