What is the alternative for deprecated Canvas.getMatrix()?

I think because of the issue with getMatrix when hardwareAcceleration is enabled, they deprecated it, as kouray said now matrix is handled by the view.


If you don't have access to a view:

To work around the problem, in most situations, you can apply any transformations using canvas.scale(), canvas.translate(), etc. rather than retrieving the matrix, modifying it and then setting the matrix again.

From the Google issue with getMatrix when hardwareAcceleration is enabled, as referenced by Sandeep.


The Matrix is now handled by the view rather than the Canvas. I unfortunately can't explain you Google's decision on this one, but you should be able to reproduce the exact same things with the 2 ways.