kotlin 中intent的传值应用

main ---- Activity

------------------------------------------------------------------------------

fun intent(position:Int,content : String){
   var intent = Intent(this@MainActivity,TestActivity::class.java)
    var bundle = Bundle()
    bundle.putInt("key",position)
    bundle.putString("name",content.toString())
    intent.putExtras(bundle)
    startActivity(intent)
}
二级Activity
----------------------------------------------------------------------------
var bundle = this.intent.extras
bundle.get("key").toString()
bundle.get("name").toString()


你可能感兴趣的:(软)