Q:

How to navigate back to an activity with restarting it? 

I have MainActivity and SubActivity, MainActivity starts SubActivity with code:
    startActivity(new Intent(getApplicationContext(), SubActivity.class));
    overridePendingTransition(R.anim.slide_up, R.anim.no_animation);

Than I do something in SubActivity and after that I have to return to MainActivity using custom animation.  Also I need a way to update MainActivity when I return to it. 
This is the code from SubActivity to navigate back to MainActivity, which does not work at all:
    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
    startActivity(intent);
    overridePendingTransition(R.anim.no_animation, R.anim.slide_down);
    finish();

If I call:
    finish();
    overridePendingTransition(R.anim.no_animation, R.anim.slide_down);

The animation is applied and I am returned to unchanged MainActivity who started SubActivity. 
If I call:
    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
    startActivity(intent);
    overridePendingTransition(R.anim.no_animation, R.anim.slide_down);

The MainActivity is recreated but I don't have my animation, also I don't know what happened to previous MainActivity which had started SubActivity. 
The finish() method is described with:
 *Call this when your activity is done and should be closed.   The
 * ActivityResult is propagated back to whoever launched you via
 * onActivityResult(). 

But I don't know how to use this ActivityResult to update my MainActivity. 
How can I return to MainActivity, using animation (which only works with finish()), and update it when I return to it? 

A:

start sub activity using:
    Intent intent = new Intent(getApplicationContext(), SubActivity.class);
    startActivityForResult(intent, REQUEST_CODE);
    overridePendingTransition(R.anim.slide_up, R.anim.no_animation);

when you want to return to main activity:
    Intent intent = new Intent();
    intent.putExtra("extra_data", "from subactivity");
    setResult(Activity. RESULT_OK, intent);
    finish();
    overridePendingTransition(R.anim.no_animation, R.anim.slide_down);

Inside mainactivity use this method to get data sent by subactivity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == REQUEST_CODE) {

        if (resultCode == Activity. RESULT_OK) {
            String result = data.getStringExtra("extra_data");
            // do something with the result

        } else if (resultCode == Activity. RESULT_CANCELED) {
            // some stuff that will happen if there's no result
        }
    }
}

