Event loop when selecting activities.