In ActivityA
, launch ActivityB
for result using startActivityForResult
and check for onActivityResult
to clear edittext
val REQUEST_CODE = 1234
startActivityForResult(Intent(this, ActivityB::class.java), REQUEST_CODE)
override fun onActivityResult(requestCode: Int, resultCode : Int, data: Intent){
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == REQUEST_CODE) {
//clear or reset edittext here
}
}
In ActivityB
, before finishing do below
setResult(1234, Intent())
finish()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…