convert x and y coordinate from one android device to another independent of resolution
android
Solution
When you save the coordinates you need to get the device independent pixels from the drawing by dividing the coordinates by the screen density and when you draw it on a device you need to multiply your coordinates by the device density. For example:
float density = getContext().getResources().getDisplayMetrics().density;
canvas.drawText(text,
xPos * density,
yPos * density,
mPaint);
Problem
I have a canvas for painting in my application and saving all the coordinate while user drawing on it. the saved coordinates are then transformed to another device and trying to plot the pixels. like this; (20,30), (50,40) .. .. .. Because of the different screen size and resolution my drawing is incomplete and positions and plotted incorrectly how can i map the coordinate to other device which should be in exact location as that of the device where i draw the actual image.