Check whether activity is active before using resources