An electronic device equipped with a camera having an autofocus function, the electronic device comprising: a display; a camera module, wherein the camera module includes a lens unit comprising at least one lens disposed on an image sensor and a lens driving unit configured to move the at least one lens; and a processor configured to: display a first image comprising an external object obtained with a first view angle by using the camera module through the display, move a location of the at least one lens along an optical axis by using the lens driving unit so that the view angle of the external object changes from the first view angle to a second view angle, wherein the second view angle is greater than the first view angle, obtain a second image comprising the external object with the second view angle by moving a location of the at least one lens with a predetermined movement distance through the lens driving unit, select a part of the second image by cropping the second image, wherein a view angle of the selected part of the second image corresponds to the first view angle, change a resolution of the selected part of the second image based on a resolution of the display, display the selected part of the second image with the changed resolution by using the display, determine a focus location of an image for the external object based on a difference between the first image or the second image and the predetermined movement distance, obtain a third image comprising the external object with a third view angle by moving a location of the at least one lens according to the determined focus location, wherein the third view angle is different from the view angle of the selected part of the second image, and display the third image through the display. a display; a camera module, wherein the camera module includes a lens unit comprising at least one lens disposed on an image sensor and a lens driving unit configured to move the at least one lens; and a processor configured to: display a first image comprising an external object obtained with a first view angle by using the camera module through the display, move a location of the at least one lens along an optical axis by using the lens driving unit so that the view angle of the external object changes from the first view angle to a second view angle, wherein the second view angle is greater than the first view angle, obtain a second image comprising the external object with the second view angle by moving a location of the at least one lens with a predetermined movement distance through the lens driving unit, select a part of the second image by cropping the second image, wherein a view angle of the selected part of the second image corresponds to the first view angle, change a resolution of the selected part of the second image based on a resolution of the display, display the selected part of the second image with the changed resolution by using the display, determine a focus location of an image for the external object based on a difference between the first image or the second image and the predetermined movement distance, obtain a third image comprising the external object with a third view angle by moving a location of the at least one lens according to the determined focus location, wherein the third view angle is different from the view angle of the selected part of the second image, and display the third image through the display. display a first image comprising an external object obtained with a first view angle by using the camera module through the display, move a location of the at least one lens along an optical axis by using the lens driving unit so that the view angle of the external object changes from the first view angle to a second view angle, wherein the second view angle is greater than the first view angle, obtain a second image comprising the external object with the second view angle by moving a location of the at least one lens with a predetermined movement distance through the lens driving unit, select a part of the second image by cropping the second image, wherein a view angle of the selected part of the second image corresponds to the first view angle, change a resolution of the selected part of the second image based on a resolution of the display, display the selected part of the second image with the changed resolution by using the display, determine a focus location of an image for the external object based on a difference between the first image or the second image and the predetermined movement distance, obtain a third image comprising the external object with a third view angle by moving a location of the at least one lens according to the determined focus location, wherein the third view angle is different from the view angle of the selected part of the second image, and display the third image through the display.