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.
```
   //* start the activity with enum defined int activity D to identify your activity
   startActivityForResult(intent, DActivity.D_REQUEST_CODE);

  //in your D activity define this
  private static final int D_REQUEST_CODE  = 1;

  //* when the button is clicked to close in your D activity, call this in the button event listner
  setResult(Activity.RESULT_OK, intent);

  //* implement this in your A activity
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) 
  {
    if(data==null)return;
    if (requestCode == DActivity.D_REQUEST_CODE) 
    {
      switch (resultCode) 
      {
        case Activity.RESULT_OK:
           //* do something
            break;
        default:
            break;
      }
    }

```