以下の.tostringをデータクラスに変換したいのですが、どのように変換しますか?
InstrumentResponse(AGM=false, AllOrNone=true, Bonus=true, Dividend=true, EGM=false, AuctionDetailInfo=AuctionDetailInfo(AuctionNumber=0, AuctionStatus=0, InitiatorType=0)
あるフラグメントから別のフラグメントにバンドルを介してデータクラスを渡すために何をしようとしていbundle.putString
ますが、これを再びデータクラスに変換する方法を使用していますか?
達成するためのより良い方法はありますか?またはdataClass.toString
データクラスに変換する方法は?
を使用する必要があります@Parcelize
。
追加
androidExtensions {
experimental = true
}
あなたにbuild.gradle
。
次に、クラスにアノテーションを追加します
@Parcelize
data class InstrumentResponse(...)
次に、値を直接 Bundle
bundle.putParcelable(key, instrumentReponse)
値を取得するには、
val instrumentReponse = bundle.getParcelable<InstrumentResponse>(key)
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加