I start an Activity1 from my MainActivity using Intent.
Activity1 takes quite a while to load (perhaps the Ads) so to reassure users that my app has not crushed I display a Circular ProgressBar in a linear layout id loading. To do this I turn Visibility of loading to Visible in the onClick event of a button.
Coming back from Activity1 I set visibility to Invisible like this:

```
 ActivityResultLauncher<Intent> resultLaunch = registerForActivityResult(
        new ActivityResultContracts.StartActivityForResult(),
        result -> {
            if(result.getResultCode()==111){
                assert result.getData() != null;
                String data= result.getData().getStringExtra("from");
                if(data.equals("activity1")) {
                    loading.setVisibility(View.INVISIBLE);// back from Activity1 switch-off 
loading

                }
            } 

```

This works well but if user clicks the back button of his phone Progress Bar stays visible forever.
I have tried to set visibility in onResume() of MainActivity but it does not work.
I rather avoid to set up a timer. Any help?