Hi,
This problem is caused by a problem with either
1) Not enough power reaching the camera
2) The lens guide which has either become slightly misaligned or disturbed by a particle of grit which is preventing the lens extending fully and therefore the camera detects an error and it retracts again.
The first thing you should do is remove the battery and clean the contacts on both the battery
and the battery compartment itself with a soft pencil eraser. This has the effect of removing any residue that is preventing a good contact.
If the problem persists you should try a brand new battery to eliminate the power issue as being the cause.
In relation to the second issue of a lens problem please view this
FixYa Tip which outlines several strategies for dealing with this.
Thanks for using FixYa. Please remember to leave a vote for the solution.