Spasms in the hips are a clear sign of Repetitive Strain injury. This injury is typically caused by over working a particular muscle group. Try improving your posture.
It may be due to over exercising, walking after taking in a large amount of food and running after a meal or due to deficiency of calcium in your body.