for Views • Easy to setup and offers enough capabilities to meet many application's needs. • Perform tweened animation on Views • A tween animation can perform a series of simple transformations (position, size, rotation, and transparency) • Defined by either XML or Android code • XML file is recommended because it's more readable, reusable, and swappable
use View.onDraw() when you do not need a significant amount of processing • Android framework will only call onDraw() as necessary. • Use invalidate() when you want to do redraw NOTE : Use postInvalidate() if you request from another thread other than main activity thread.
specialized drawing and/or control the animation of graphics, you should do so by drawing through a Canvas Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b);
offers a dedicated drawing surface. • The aim is to use background thread, therefore the app isn't required to wait until the system's view hierarchy is ready to draw • Extend SurfaceView • Implement SurfaceHolder.Callback • Handle everything via a SurfaceHolder
• You can hardware accelerate the majority of the drawing done by the Canvas APIs to further increase their performance. • In manifest, add the following attribute <application android:hardwareAccelerated="true" ...>
accelerometer • Rotation vector sensor • Significant motion sensor • Step counter sensor (Kitkat) • Step detector sensor (Kitkat) Motion sensors by themselves are not typically used to monitor device position, but they can be used with other sensors