Tuesday, February 15, 2011

Android Graph 2D with bells and whistles

I learned a few new (basic) things about Android programming.
1. They don't do dialog boxes with many controls, you need a new "Activity" to do that, and you can toss parameters around with an "Intent".

The config dialog


2. There are various kind of menus in Android, you launch menu with the menu button and can add your own menu items in bottom of screen (options menu).

Options menu for zooming




3. Now the ultimate bells-and-whistles for a graphing app: I can drag the graph around with a onTouchEvent. I bet your graphic calculator can't do that.

All these activities change the x and y range and will refresh the View within.

2 comments:

Unknown said...

I'm looking to do something similar but i want it to update constantly like for example a heartrate monitor. Is this possible in the same manner?

Joseph Mak said...

Well I don't know how to attach something from your heart to android to show your heart rate, but graphing.... is the same idea. take x-y data, and plot them, you just have to translate and scale correctly to make your data look right.