Replace the battery first, although that may not fix this. If it's a smartphone you can try to reload the ROM on it from a download, you can find the base ROM along with the instructions for it with a web search.
Issue may be caused by hardware failure as well, in that case you'll have to replace the phone.