StartActivityForResultHelper
严重缺陷告警: 如果 源activity被回收, 是拿不到结果的 ;请使用 Activity Result API
灵感来自RxPermission
//kotlin
this@MainActivity.startActivityForResult(Intent(this@MainActivity, MainActivity::class.java),1000,false) {
Log.e("AAA", it.resultCode.toString())
}
//如果简洁模式,只有RESULT_OK 才会执行,默认为true
this@MainActivity.startActivityForResult(Intent(this@MainActivity, MainActivity::class.java)) {
Log.e("AAA", it.resultCode.toString())
}
//java
ActivityHelper.startActivityForResult(this, new Intent(this, MainActivity.class),1000,
new ActivityHelper.Callback(false) {
@Override
protected void onResult(ActivityResult result) {
}
});
ActivityHelper.startActivityForResult(this, new Intent(this, MainActivity.class),
new ActivityHelper.Callback() {
@Override
protected void onResult(ActivityResult result) {
}
});