Air-stable solution processed all-inorganic p-n heterojunction ultraviolet photodetector is fabricated with a high gain (EQE, 25 300%). Solution-processed NiO and ZnO films are used as p-type and n-type ultraviolet sensitizing materials, respectively. The high gain in the detector is due to the interfacial trap-induced charge injection that occurs at the ITO/NiO interface by photogenerated holes trapped in the NiO film. The gain of the detector is controlled by the post-annealing temperature of the solution-processed NiO films, which are studied by X-ray photoelectron spectroscopy (XPS).