An electronic device comprising: a proximity sensor ; a ranging sensor ; a touchscreen display comprising a display and a touchscreen ; and a controller configured to switch a sensor to be operated between the proximity sensor and the ranging sensor in accordance with a distance between an object to be detected and the electronic device , wherein distances at which the proximity sensor and the ranging sensor are capable of detecting the object to be detected are different, wherein the controller is further configured to perform at least one of the following: turn the proximity sensor from on to off and turn the ranging sensor from off to on, in response to the object being no longer detected by the proximity sensor ; and turn the ranging sensor from on to off and turn the proximity sensor from off to on, in response to the object being no longer detected by the ranging sensor , and wherein the controller is still further configured to estimate the distance between the electronic device and the object to be detected by calculating the distance of the object to be detected from the electronic device based on the output of the ranging sensor , characterized in that the controller is configured to turn the display on or off in accordance with the estimated distance. a proximity sensor ; a ranging sensor ; a touchscreen display comprising a display and a touchscreen ; and a controller configured to switch a sensor to be operated between the proximity sensor and the ranging sensor in accordance with a distance between an object to be detected and the electronic device , wherein distances at which the proximity sensor and the ranging sensor are capable of detecting the object to be detected are different, wherein the controller is further configured to perform at least one of the following: turn the proximity sensor from on to off and turn the ranging sensor from off to on, in response to the object being no longer detected by the proximity sensor ; and turn the ranging sensor from on to off and turn the proximity sensor from off to on, in response to the object being no longer detected by the ranging sensor , and wherein the controller is still further configured to estimate the distance between the electronic device and the object to be detected by calculating the distance of the object to be detected from the electronic device based on the output of the ranging sensor , characterized in that the controller is configured to turn the display on or off in accordance with the estimated distance. turn the proximity sensor from on to off and turn the ranging sensor from off to on, in response to the object being no longer detected by the proximity sensor ; and turn the ranging sensor from on to off and turn the proximity sensor from off to on, in response to the object being no longer detected by the ranging sensor , and wherein the controller is still further configured to estimate the distance between the electronic device and the object to be detected by calculating the distance of the object to be detected from the electronic device based on the output of the ranging sensor , characterized in that the controller is configured to turn the display on or off in accordance with the estimated distance. <EOS>