0

I want to Place a point on Particular position over a bitmap of particular size.I created the bitmap of 600 by 800 size and place a point according to that and it works fine on note 2,

But when I tested this on Samsung S4,the bitmap is looking very small and the point is also not in particular position.

Please help me to suggest that is there is any way so that my bitmap is automatically scaled according to particular resolution of phones and the point is placed at same position on the screen.

  • Paste the code or at least tell us where this point is, apparently the position has to be calculated, but without the additional info, we can be of no help. – g00dy Aug 01 '13 at 11:38

1 Answers1

0

I think I can help you. I had this same kind of problem myself. What you need to do is find how much larger this new screen is than your old one, by first getting the dimensions of your device and putting them in for widthOfStandardDevice and heightOfStandardDevice.Once you know how much larger the new screen is then your old one, you would make two multipliers to multiply everything by. You can now say set the size of the bitmap to bitmap_width and bitmap_height.

DisplayMetrics displaymetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

height = displaymetrics.heightPixels;

width = displaymetrics.widthPixels;

float widthMultiplier = width/widthOfStandardDevice;

float heightMultiplier = height/heightOfStandardDevice;

int bitmap_width = (int)(600 * widthMultiplier);

int bitmap_height = (int)(800 * heightMultiplier);

superuser
  • 731
  • 10
  • 28
  • 1
    When you are setting absolute coordinates, you need to scale them this way so that they end up in correct place on every screen size. Multiply the point's coordinates also with the multipliers. – superuser Aug 01 '13 at 11:50