Android realizes the shake function
•
Android
In fact, it is very simple to realize the "shake" function, which is to detect the gravity induction of the mobile phone. The specific implementation code is as follows:
1. At androidmanifest Add operation permissions to XML
2. Implementation code
This kind of shaking is relatively common. Without the enhancement of the algorithm, the gravitational acceleration is 10. The algorithm is optimized as follows
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码