Most likely, this symptoms is associated with stomach or intestinal ulcer. When your stomach has no food, then no acid is secreted, as a resul you dont have pain. When you take meals, acid is formed, and it causes severe pain.
To make a diagnose , you need to get- Endoscopy done. Treatment can be done after this test.
As such you should soon , get this test done, and get appropriate treatment.
I hope this has helped.