End child activity when parent activity ceases

There is one action in my A1 program. In A1 onCreate, I use the intent to trigger android activity ("A2"):

Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI);

        startActivityForResult(contactPickerIntent, 1010);

When the user selects a contact, I want to use the contact information in A1. Everything is fine, but ...

When I use the home button in A2, A1 and A2 in memory, and if the OS kills A1 (or I can do it from the task manager), A2 works, and when I run my program, I see OLD A2, and when I I select the contact, I don’t see the result in A1, because NEW A1 starts and it calls NEW A2.

Question: how can I kill A2 when someone kills A1 from memory.

+4
source share
2 answers

finishActivity (CHILD_ACTIVITY_REQUEST_CALL) onStop() .

:

public void onStop(){
    finishActivity(1010);
}
+4

, .
, nbarraille, . , , , Android, - .

, , -, Android. , , , , . , Android "", ( , ).

, , , , A2 , A1, , , A2.

0

All Articles