I’m writing an app that requires getting the mic level to create a sound meter. I have found this: Android Media Player Decibel Reading. I still need to create a meter to display the current level, out of 100% kind of deal. So a bar that the higher it gets it gets redder for example. Just getting the code to display the level is great.
In the link above there is a method for getting the current decibel reading, however it appears to be something that I would need to possibly run in a separate thread and update it constantly. I was reading into a VU meter but have no clue where to start.
Thanks in advance!
Okay I’m assuming your working with the code you linked to in your question.
So this meter will have to change its size and colour on the fly depending on the value of amplitude.
To draw the shape extend the View class and override the onDraw method as shown below
To make the meter change every ‘x’ seconds you will have to call
postInvalidate()repeatedlyOR
Use an Animation, and call
startAnimation()on it from your View.