Welcome to Android Central! Do you hear any buzzing noises from the camera when it tries to focus? Is it simply not focusing at all, or does it focus and then lose the focus?
Remember that the autofocus mechanism is one of two moving parts in the phone (the other being the vibration motor), so it can be prone to breaking.