Android Multiple SurfaceViews

You can have multiple SurfaceViewsin one layout. The “Multi-surface test” activity in Grafika has three. The first post cited in @nonsleepr’s answer was followed up 9 months later with this post by the same author, which mentioned the existence of SurfaceView#setZOrderMediaOverlay(). The key thing to understand is that SurfaceView is not a regular view. When … Read more

How to draw Arc between two points on the Canvas?

Finally I got the solution from this code: float radius = 20; final RectF oval = new RectF(); oval.set(point1.x – radius, point1.y – radius, point1.x + radius, point1.y+ radius); Path myPath = new Path(); myPath.arcTo(oval, startAngle, -(float) sweepAngle, true); To calculate startAngle, use this code: int startAngle = (int) (180 / Math.PI * Math.atan2(point.y – … Read more

Trying to get the display size of an image in an ImageView

None of the answers here actually answer the question: From a Bitmap of any size displayed by an ImageView, find the actual dimensions of the displayed image as opposed to the dimensions of the supplied Bitmap. Namely: Using ImageView.getDrawable().getInstrinsicWidth() and getIntrinsicHeight() will both return the original dimensions. Getting the Drawable through ImageView.getDrawable() and casting it … Read more