One of the most effective ways to solve the dilemma between resources shortages and increasing demand is to develop a cost-effective approach for recovery and reuse of the precious metals (especially Au and Ag) derived from e-wastes (electronic devices and the components thereof), which will most likely be driven by breakthroughs in environmentally friendly methodologies that combine the economy of scale with function. Here a facile and novel approach is described for the recovery of gold from simulated e-wastes by using hollow polyaniline nanospheres (P(VAn-g-PANI)) in which PANI and its derivatives can not only be used to reduce Au3+ to Au0 from the metal salts, but also be used to stabilize the achieved polymer nanosphere-supported Au nanoparticles (Au@P(VAn-g-PANI)). The Au@P(VAn-g-PANI) was directly used to fabricate electronic devices with a configuration of Al/Au@P(VAn-g-PANI) + PVA]/ITO, in which Au@P(VAn-g-PANI) was uniformly integrated into poly(vinyl alcohol) (PVA) as electrically insulating matrix. When the Au/N molar ratio in P(VAn-g-PANI) reached 1:10, the device could be electrically erased and reprogrammed showing typical nonvolatile rewritable memory effect, with an ON/OFF current ratio exceeding 105, a turn-on voltage of −1.85 V and a turn-off voltage of 2.90 V. In the case of Au/N molar ratio of 1:1, the corresponding device exhibited conductor behaviour. This work opens a way that can both recycle gold in situ from e-wastes and fabricate electronic devices by using polymer nanosphere-supported Au nanoparticles.