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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.