Don’t take away the iPad!
At five years-old, it’s no fun getting interrupted while you’re focused on something. As a parent, I compensate for that by employing a series of intricately planned measures to guide my son from whatever he happens to be doing towards whatever it is that I want him to do instead.
The extremity of these measures depends entirely what’s being interrupted. If he’s playing outside with his sister, the steps I take are fairly mundane. I give him a few, gentle time checks (“five minutes until dinner” … “3 minutes until dinner” …), and then offer something enticing enough to make putting down the ball seem like less of an intrusion (“Tonight’s chicken has both teri and yaki on it!”).
If I need to transition my son from building a cardboard village with grandma to going to bed for the night, I need to combine my time checks with some subtle threats and an Obi Wan Kenobi-like response to his three hundred or so repetitions of some variation of, “No. I don’t want to. But you said. Why are you doing this to me?”
The techniques are all pretty simple and effective. Until it’s time to get him to put down the iPad.