I have seen several things cause the phone to act this way, more often then not people download software they have no business with and play with things they do not know about and mess up the phone. But as of late I have seen almost as many phones doing this just from being dropped.
Most of the connectors inside the phone use a self locking system that is very weak and often the shock of an impact will cause the conector to loose connection for a second but long enough to cause an interenal software error that can only be fixed with a software reload. If your phone is working now and no other problems occur you should be fine if not take it into a service center.