I want when I shake my phone it randomly generate some no.
I am working with API2.2 and try to using SensorListener
but it shows that it is deprecated.
so which one I have to use.
please give me any suggestion how to do this. Thank you
As Xion said, use SensorEventListener
. There are many examples of this here on SO; for instance, check out this one. For testing shakes in an emulator, something like SensorSimulator might also help.