CHARGE
val value: String = txt_act_main.text.toString() // or just your string
val intent = Intent(this, SecondActivity::class.java)
intent.putExtra("value", value)
startActivity(intent)
// option 2 toutes les classes internes doivent être implémentées à Serializable
getIntent().putExtra("complexObject", clickedTitle);
AVOIR
var bundle :Bundle ?=intent.extras
var message = bundle!!.getString("value") // 1
var strUser: String = intent.getStringExtra("value") // 2
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
//Option 2
var myProg = intent.getSerializableExtra("complexObject") as MenuModel
IMPLICIT (à partager avec d'autres applications)
val value: String = txt_act_main.text.toString()
var intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_TEXT, value)
intent.type="text/plain"
startActivity(Intent.createChooser(intent,"Share to "))