Resources for teachers and students of introductory physics
Note that I'm not in any way making the rule "no texting in the bathroom!" Uh-uh. That sounds condescending, it gives students ideas, and it worries the rule-followers. No rules here, in fact I'm giving students freedom from rules - in other classes, they feel oppressed that they have to ask permission to exercise a simple bodily function, and furthermore that the teacher is likely to nag them about their body's timing. Here, they are free to do as they need to. Yet, trust but verify. Since the phone goes on the desk as a matter routine (not rule), there won't be any texting in the bathroom. Then it's my job to hold activities interesting enough to minimize using the bathroom as an excuse to relieve the boredom of class.
My rule for the past few years that has worked well: I have a small corner of my white board marked with masking tape. A student must write their name and the time they left in that section. Then they go... don't ask me or stop class. I figure many of my students are draftable, and it's insulting that I have to stop teaching to acknowledge someone needs to go pee. I have them write their name down so I always know who is out, and if a student is getting in trouble out of class then I can always take away this privilege and make them ask permission... I have had one student in three years who had to ask, after he was waving to friends in other classrooms and interrupting those classes.