created activity switch function