The energy consumption and applications' execution latency of mobile devices (MDs) can be improved by migrating application tasks to a nearby edge device. In this paper, we propose an optimization framework to investigate the scenario when a MD can offload tasks to multiple access points (APs) and scale its central process unit (CPU) frequency. Firstly, the optimal solution is derived from an exhaustive search based approach; and then a semidefinite relaxation (SDR) based approach is proposed to efficiently solve the problem. The obtained results from our simulation indicate that the SDR-based algorithm is able to achieve close-to-optimal performance. We also show that our proposed scheme can reduce the MD's energy consumption and tasks' execution latency, by taking advantage of having multiple APs and flexible CPU frequency.