my galaxy s5 g900p keeps restarting...

A

AC Question

it works at times and then the screen goes off, when i remove the battery and restart it...it comes on and loads sometimes and other times it refuses..i was given advice to have the software flashed and i have had it flashed twice...but the problem is still there..any suggestions on what i should do?