Writers often confuse while and meanwhile.
While is a conjunction; it starts a subclause and means during the time that.
This all happened while you were asleep.
While you peel the potatoes, I will make the salad.
While driving along the coast, Robert noticed a large number of birds flying just above the waves.
To indicate that something happened at a point in time we use when.
I was reading the newspaper when there was a sudden knock on the door.
We can use while to contrast ideas:
While Germans are beer drinkers, most Italians prefer wine.
Here while has the meaning of in contrast, on the other hand, unlike or whereas.
In British English you can sometimes see the form whilst, which is more formal than while.
While can also be a noun meaning a period of time:
I’ll be back in a while.
He hadn’t seen her for a while.
Meanwhile is an adverb and usually starts a new sentence. It means the same as in the meantime, all the while or at the same time.
Susan went out in the garden to pick some flowers. Meanwhile, I decorated the cake.
Start boiling the water for the rice. Meanwhile, slice the tomatoes and the carrots.
Notice that it is wrong to write *in the meanwhile. It must be either meanwhile or in the meantime. (For the use of the asterisk, see my comment at the end of this text.)