In camera apps, if zoom is digital, how is (auto) focus achieved?
The focus function is achieved by moving the lens back or forth so it is actually a mechanical thing.

You can try it yourself. Download ZXings Barcode Scanner and fire it up. You'll hear a click every time it tries to refocus you can also see the lens moving back and forth.