Fix life cycle management calling order in MainActivity.