Convert Map to Bundle in android

前端 未结 7 2149
面向向阳花
面向向阳花 2020-12-29 17:58

Is there an easy way to convert a Map to a Bundle in android without explicit iteration?

Why?

Firebase returns a Map for Notification

7条回答
  •  孤城傲影
    2020-12-29 18:51

    here is how I did it in Kotlin

    val bundle = Bundle()
    
    for (entry in data.entries)
        bundle.putString(entry.key, entry.value)
    

提交回复
热议问题