Android 4.0.3 and finish activity

China☆狼群 提交于 2019-11-28 07:35:45

问题


I have Activity A calling activity B, Activity B dials a number and then on the IDLE-OFFHOOK- IDLE state I call ActivityB.this.finish() so that activity A shows on front.

this all worked fine from android 2.3.x till 4.0 version.

Now it doesn't work on android 4.0.3 emulator and 4.0.2 samsung galaxy nexus 2. Why?

Can someone help?


回答1:


Better solution for this case is to use startActivityForResult.

You can switch activity from A to B, in activity B do your work and handle results in activity A at override method onActivityResult().




回答2:


It might be the case that you have overridden onDestroy method and it is falling over because of an Exception (only occurring in 4.0), which is preventing the Activity from closing properly. Also just try to invoke finish() simply on Activity B.



来源:https://stackoverflow.com/questions/9551821/android-4-0-3-and-finish-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!