Muscle cramping can be caused by many things, potassium being one of them. If you are taking a diuretic, this can aggravate it. If this is the case, your doctor should do a blood test to see if your electrolytes are normal. If your potassium is low, you will need a prescribed supplement. You might have to eat an awful lot of bananas.
However, if you think potassium will help---other high sources are potatoes and tomatoes, as well as citrus fruits.
Some other things could be causing it, or at least aggravating your condition. A low blood calcium level will cause cramping. You might try a good calcium supplement, or again, ask your doctor to check your blood level.
Another cause is dehydration. Older people can become dehydrated without even knowing it. Make sure you are drinking 6-8 glasses (8 oz) of water every day along with some fruit juice and milk. (more potassium and calcium).
Things like too much coffee, black tea, cola drinks and alcohol have diuretic effects and may cause dehydration and/or electrolyte disturbances. And again, as we age, our bodies become less tolerant, and are unable to compensate for our excesses.
So, to sum up, here's my suggestion to you:
If that doesn't work, or you have other conditions (or are taking medications) that would prevent you from doing these things----
Call your doctor for an appointment to evaluate the condition and do some blood tests.
Sorry, I forgot to mention---
If you try a calcium supplement, it should contain magnesium as well. Just ask the pharmacist at your local drug store for a good one.
As for exercise, sometimes cramping can be caused by poor circulation in the legs. Mild exercise has been shown to improve this in many people.
And, thank you for your "accept" and for using Just Answer.
Wishing you many Pleasant Days.