For me (8 times in 2 months) S4.
Take out your battery, sim and SD card (if you have one)
Restart your phone.
Ok the error message, before it comes back (1/2 second with me) you must get your finger on the screen where you need it to be.
Hold your finger on the screen and complete your action (Me i have to pattern to unlock) complete your action before you lift your finger or you will have to ok the error message again.
You must use two fingers, one to ok the error message the second ready to touch the screen where you need to before the message comes back.
Do the following in the order its written
ok the error message, open settings, ok, More, ok, Application Manager, ok, swipe over to ALL, (to the right) ok, scroll down using two fingers so you always have contact with the screen,
go down till you see Contacts Storage and lift your fingers, ok, Contacts Storage, ok, Clear cache, ok, Clear data, ok,
The error message should now be gone, IF NOT, back, ok, Contacts, ok, Clear cache, ok, Clear data, ok,
Take battery out of phone, sim back in, SD card back in (if you have one).
Restart your phone and leave it for a few mins to sort itself out.
I find it automatically reloads all my data as its backed up on SD card and online at Lookout.
Dont know about any other phone and didnt have this problem with the S3