有一个在我的节目A1一项活动。 在A1的onCreate我使用意图调用Android的活动(A2):
There is one activity in my program "A1". In A1 onCreate i use intent to call android's activity ("A2"):
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(contactPickerIntent, 1010);当用户选择一个联系人,我想用在A1联系人信息。 一切都很好,但是......
when user picks a contact i want to use contact's information in A1. Everything is ok, but...
当我使用Home键,在A2,A1和A2 STIL在内存中,如果OS杀死A1(或者我可以从任务管理器做到这一点),A2被STIL运行,当我开始我的节目,我看到一个老A2,而当我拿起一个接触我看不到导致A1,因为新的A1开始,它需要新的A2。
When i use "home button" in A2, A1 and A2 stil in memory, and if OS kill A1 (or i can do it from task manager), A2 is stil running and when i start my program i see an OLD A2, and when i pick a contact i cant see result in A1, because NEW A1 is started and it calls for NEW A2.
现在的问题是:我怎么能杀A2,当有人杀死A1从内存
The question is: how can i kill A2, when somebody kills A1 from memory.
推荐答案您只需调用父活动finishActivity(CHILD_ACTIVITY_REQUEST_CALL)中的onStop()方法。
You can just call finishActivity(CHILD_ACTIVITY_REQUEST_CALL) in the onStop() method of your parent activity.
在你的情况:
public void onStop(){ finishActivity(1010); }更多推荐
当父活动停止完成子活动
发布评论