Creating a simple app that calculates the speed your going and displays it in a speedometer graphic. I can do all the speed calculations, gps calculations etc.. but i am not too sure about the animation. Does anyone have any good tutorials or examples on needle gauges other than the thermometer example out there?
I know, the post is quite old. But I had the same situation: there is no a good control for representing speed. I guess many people are facing this.
I've implemented SpeedometerView myself: a simple speedometer with needle and colored value ranges. Feel free to download!
https://github.com/ntoskrnl/SpeedometerView
This control was used in my app CardioMood.
The code is not optimized, but works. Enjoy!
Check here. It is my code. If you have any question please let me know.
Visit https://github.com/mucahitsidimi/GaugeView
You can implement Gauge to your project simply.
<com.sidimi.mucahit.gaugeview.GaugeView
android:id="#+id/gaugeView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
You can set width and height what ever you want to. It will calculate everything automatically.
Check the solution i found for my case.
Big thanks to the owner Evelina Vrabie...
You could probably start with something like this.
Then when transitioning between values, do an animation where the needle gradually moves to the next value X units per unit of time.
This question is also very similar to yours.
Related
I'm trying to learn App Inventor 2, by implementing the tutorials and redo some in another way. I'm currently trying to make a compass similar to this, but instead of the classic rotating disk, I want to have a linear display, something like this.
Should the code blocks used in the rotating compass be altered in a way, to have the linear compass effect? By simply changing the displaying image does not work.
I'm currently using this block combination:
"when OrientationSensor1.OrientationChanged
do set Compass.Heading to get azimuth +180 (to get N always)"
Can someone give me a clue on how to implement a working linear compass in app Inventor 2, if it is possible? Thank you all in advance for your answers.
You can draw one yourself using the canvas.
Check this example how to render it, it draws the North mark only, but you can extend it easily to draw all other marks...
Before use I would try if this approach (redrawing the old position of marks) is not slower of faster than clearing the whole canvas (might perform faster).
Good luck.
I need to get the area of a known object inside a scene to get the distance from that. The problem is rectifying it so that the area is independent from the angle.
I'm using opencv (on Android) with some java code that is equivalent to this:
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography
In other words: how do i get the area of the object observed perpendicularly from that distance given the H matrix.
Thank you in advance and sorry for my poor english... :)
You can call cvCalibrateCamera, but am not sure if it works with one image only. The algorithm it is based upon can cope with the one image case, see section 3.1. where it says "if n=1...". So in a pinch you can re-implement it.
Basically, I am making a rectangle that represents charge on your weapon. I want a green rectangle to advance over a red one after a certain amount of time. My issue is the timing. I have no clue how to do any timing anything in android.I'm fairly new so don't use too many things I might not understand. All of this is within a view. I researched threading and handlers, but just got confused.
Check out View Animations if you want to support pre 3.0 without using a library. OR Property Animations if targetting 3.0+ is ok.
I have more experience with the View Animations and I can tell you that the Scale animation is the one you'd be looking for. Make your X scale to 100% its size perhaps would get the job done.
I want to achieve particle effect when an object is found. I have relative Layout on which I have many ImageViews are Placed now when user click on the ImageViews I want some particle effect to happen ( I do not want sprite animation ). How will I achieve it ? any good reference or help ?
I had the same problem as you, and following the recommendations, I implemented it, and also open sourced it as a library.
https://github.com/plattysoft/Leonids
It is quite easy to use and also very lightweight.
You probably had this sorted out since the question is quite old, but I hope it will be useful to other people with the same problem.
You can check this question which has some good link to Patricle Effects tutorial
How to create fireworks particle graphics effect on android
Is there a best-practice how to handle a larger number of playing pieces?
(Do I have to use imageViews for EACH piece?!?)
How would you make only the top one in a stack selectable/clickable?
(I am about to transform a game I wrote in javascript/xml to run on android phones.)
You can do a view for each piece. You could give each view the same handler and then, since the handler passes the view that was clicked, check to see which view was clicked with a loop of if(pieceView == touchedView).
You could also override the
Activity.dispatchTouchEvent(MotionEvent)
function. This will give you the coords that were touched and from there you can figure out which piece was touched. One thing to keep in mind is that the X and Y values will be in Pixels and that the screen resolution can change depending on the phone. It would be good to convert these values into a resolution independent value before using them.
I performance wise view can be very slow, you shouldn't have too much trouble with that if you are making a traditional boardgame though.
I will answer "myself" because his is mainly a quote...
Romain Guy, software engineer at Google answered my direct question to him:
Hi,
Using one ImageView per game piece would be a bad idea :) Instead you should create a custom view and draw the pieces on the Canvas from the onDraw() method. This is much more efficient.
Thanks to Romain - I just wanted to share his comment with everybody interested!