The dynamics of charge carriers (electrons) hopping through a nonhomogeneous medium in semiconductor layer is investigated by changing a thermal noise of strength D and an external harmonic potential V(x). The nonhomogeneous medium exhibits denser trap distribution around the center, which biases the electrons to therein concentrate. Applying also a monostable potential at the center further enhances the accumulation of electrons. However, by applying a nonhomogeneous hot temperature in the vicinity of the potential minimum forced the electrons to diffuse away from the center and redistribute around two points. Thermally activated rate of hopping and diffusion of electrons in a nonhomogeneous medium, as a function of model parameters, is also considered in the high barrier limit. Using two states approximation, I have also studied the stochastic resonance (SR) of the electrons dynamics in the presence of a time-varying signal. I found a strong spectral amplification η and lower temperature occurrence of its peak as compared to previous works [M. Asfaw, B. Aragie and M. Bekele, Eur. Phys. J. B 79, 371 (2011); B. Aragie, Y. B. Tateka and M. Bekele, Eur. Phys. J. B 87, 101 (2014)].