draw square 3x3 cm in Android

view full story

http://stackoverflow.com – I need to draw an exact square 3x3 cm on the screen, you need the exact dimensions in any type of screen as design work. The result in a Samsung Ace is 2.8 cm, the result is not exact. Java... DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); float ld = 30 * metrics.densityDpi * (metrics.density/25.4f); bitmap = Bitmap.createBitmap((int) ld, (int) ld, Bitmap.Config.ARGB_8888); canvas = new Canvas(bitmap); paint = new Paint(); paint.setColor(Color.WHITE); imageView.setImageBitmap(bitmap); canvas.drawRect(0, 0, (float) ld, (floa (HowTos)