Question: I have a `main activity A` -> `call activity B` -> `call activity C` -> `call activity D`. 

Activity is called by `startActivity(intent).`
`Activity D` have a "Close" button. 

How to I notify to `Activity A` when hit "close" button on `Activity D`?

Any help is appreciated.

Answer: 
Try this:

Use SharedPreference to store the status of button in Activity D. 

In activity A under onResume() get the status of button from the SharedPreference.
```
    findViewById(R.id.button_close).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent(this, Activity_A.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK));
        }
    });

```

This will work if you are looking to simply show Activity A while clearing the activity stack. If you just want to know when you return to Activity A, you can save status in SharedPrefs as answered above.