B
B
bracadabra2014-12-19 00:30:41
Android
bracadabra, 2014-12-19 00:30:41

How to animate View based on accelerometer readings in Android?

Hello everyone, there is the following problem, let's say there is a static element in the middle of the screen, in this picture it is the cursor (the example is not very good, but I couldn’t find it better)
images?q=tbn:ANd9GcTwiIxT6x8HNxb2LJLOrtF
and so it is necessary that, depending on the accelerometer readings, a trail is drawn from it in different directions. For example, now I read the readings and, if the values ​​​​are above a certain threshold, I draw an animation on the Canvas by periodically calling Runnable until the values ​​\u200b\u200bare below the specified threshold. What are the pitfalls of this solution? Are there any standard approaches to implement such functionality?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question