- A使用startActivityForResult开启BA,BA中调用setResult+finish返回A.两者生命周期
A: @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.e("Jet","A:onActivityResult"); if(resultCode==101){ Log.e("Jet","A:onActivityResult:101"); } } public void startActivityForResultLC(View view) { Intent intent = new Intent(this,BA.class); startActivityForResult(intent,100); } BA: public void setResultTest(View view) { setResult(101); finish(); } Log: 2018-11-28 11:18:58.837 E/Jet: A:onCreate 2018-11-28 11:18:58.861 E/Jet: A:onStart 2018-11-28 11:18:58.867 E/Jet: A:onResume 2018-11-28 11:19:02.615 E/Jet: A:onPause 2018-11-28 11:19:02.750 E/Jet: BA:onCreate 2018-11-28 11:19:02.760 E/Jet: BA:onStart 2018-11-28 11:19:02.763 E/Jet: BA:onResume 2018-11-28 11:19:03.375 E/Jet: A:onStop 2018-11-28 11:19:09.134 E/Jet: BA:onPause 2018-11-28 11:19:09.162 E/Jet: A:onActivityResult 2018-11-28 11:19:09.162 E/Jet: A:onActivityResult:101 2018-11-28 11:19:09.167 E/Jet: A:onRestart 2018-11-28 11:19:09.168 E/Jet: A:onStart 2018-11-28 11:19:09.172 E/Jet: A:onResume 2018-11-28 11:19:09.733 E/Jet: BA:onStop 2018-11-28 11:19:09.737 E/Jet: BA:onDestroy 复制代码
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 数组常见的遍历循环方法、数组的循环遍历的效率对比
- C++拾趣——STL容器的插入、删除、遍历和查找操作性能对比(Windows VirtualStudio)——遍历和删除
- Js遍历数组总结
- 遍历 DOM 注意点
- MySQL 实现树形的遍历
- golang之树的遍历
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The NSHipster Fake Book (Objective-C)
Mattt Thompson / NSHipster Portland, Oregon / 2014 / USD 19.00
Fake Books are an indispensable tool for jazz musicians. They contain the melody, rhythm, and chord changes for hundreds of standards, allowing a player to jump into any session cold, and "fake it" th......一起来看看 《The NSHipster Fake Book (Objective-C)》 这本书的介绍吧!