あいだ、 ...あいだに、...

Usage

Vている / Nの + (あいだ / あいだに).

[Xあいだ, Y] shows that, in a situation where both X and Y continue for a certain period, Y is going on at the same time as X

[Xあいだに, Y] shows that an isolated event (Y) takes place in a situation where X is going on

Examples

電車に乗っているのあいだ、本を読んでいた While on a train, I was reading a book
夏休みのあいだ、ずっと国に帰っていた I was back in my home country for the whole of the summer holidays
食事に出掛けている間に、部屋に泥棒が入った。 A burglar broke into my room while I was out to eat