I have an activity with a timer in it, which starts an activity when the timer goes down. Before, when onPause() would get called after a phone call, my activity would hang because the timer would also stop. My objective was to completely restart the activity from new when this happened, so I came up with this code:  @Override    protected void onPause() {        super.onPause();        resetTimerIfExists();        recreate();    }    public void resetTimerIfExists(){        if(timer != null) {            timer.cancel();            timer = null;        }    }My onCreate method instantiates the timer again. Is this a good way to solve my problem? Is it efficient?
Restarting properly
java;performance;beginner;android;timer