A soft reset, like with iphones without a home button you hit in sequence volume up volume down then hold power button down until you see the apple logo then release.
Androids i usually just pull the battery for a minute then start back up.
Here is a link find your phone
How to soft reset your phone
This should be done every once in a while anyway to keep your phone running smoothly.
Also not having a lot of apps open also helps run smoothly. (1 or 2 apps even up to 5 apps fine but 10 apps open something will always get screwy)
Just doing these things will help it not to happen as often, if at all.