0

I'm trying to write an app that takes values form the accelerometer and displayes them via a bar gauge (or maybe needle gauge) but I'm not to sure how to get the gauge to work. I was thinking of these options:

  1. break the gauge into multiple parts and therefore multiple images, of the gauge "filling up" and depending on the values from the accelerometer, display a different image.

  2. Have just the one image of a full gauge and programmatically decide how much of the image to show. I dont fully understand how to do this but it seems to be a more elegant way of doing what I want as it means that I only need to have the one image that will be manipulated and thus saving space.

I am confident that I can impliment the first option sucessfuly without too much hassle, but is it just taking the easy way out? Which of the 2 methods should I use? Is there another way to do this that I don't know about?

Any advice will be very much appreciated :)

Ian
  • 1,490
  • 6
  • 24
  • 39
  • You are confident that you can do option 1 easily. Do it. – Atreys Jul 22 '11 at 13:54
  • If I'm left with no other option then I will, but I'm not going to get any better if I just keep taking the easy way out if you know what I mean? I hold the belief that if something is worth doing, then it's worth doing well. – Ian Jul 22 '11 at 14:02
  • 1
    Ah, for learning new technologies, I think that's a good idea. If you were just wanting to get it done, doing what you're most comfortable with is a good route. #2 might be done by [drawing a portion of the image](http://stackoverflow.com/questions/4504027/draw-only-a-portion-of-a-drawable-bitmap), if the gauge is rectangular. Something fancier might be possible with a [custom UI](http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/) (that link looks like a fun and instructive activity, in any case). – Atreys Jul 22 '11 at 15:03
  • great! Thanks for your help! if you want to post that as an answer I'll accept it :) – Ian Jul 22 '11 at 15:23

1 Answers1

3

If you are concerned about meeting a deadline, then doing what you are comfortable with is advisable; but, as you are exploring new techniques, #2 might be done by drawing a portion of the image, if the gauge is rectangular. Something fancier might be possible with a custom UI (that link looks like a fun and instructive activity, in any case).

Community
  • 1
  • 1
Atreys
  • 3,741
  • 1
  • 17
  • 27
  • I decided to impliment it whe way I know how (and it's working :) and then try to learn the new way, and if I can get that working before the deadline then I will change out the code :) Thanks! – Ian Jul 26 '11 at 09:47