I am working very hard on my CardioMood app for Android.
As described in one of my previous posts, CardioMood is a health monitoring social service with a stress monitor app. It measures your stress level according to heart rate variability. It also shows a bunch of other parameters, which are represented as different kinds of charts.
Stress Index is a quantitative characteristic of your stress. Normally, the value of Stress Index varies from 50 to 150. The SI value outside of the range could be caused by a number of factors, such as physical or emotional stress, diseases (including heart diseases), and low quality of data obtained from heart rate sensor.
In CardioMood Stress Monitor app, we need to visually represent a calculated value of Stress Index – and that is another problem. I decided to use a speedometer-like gauge.
A simple way: WebView
In our measurement report screen used WebView to visually represent the result.
So, WebView gives you an easiest way to add Speedometer gauge to your android app. In our case we used a solution from Geek’s Retreat.
We had hard time with sizing and layouting components in WebView. Soon, we realized that WebView is not reliable – it’s better to use native controls than spend days on fixing issues and supporting diverse screen densities and sizes in HTML.
Hard way: Implementing Android custom view
- Major and minor tick marks
- Custom labels
- Colored value ranges
- Animation of arrow (requires Android API level 11+)
Check out a GitHub repo to see source code, release binary and usage example.
UPD: The component was moved to AndroidWidgets library.
Feel free to comment, request features or report bugs.