I got width and height of the screen by following code
WindowManager wm = ((WindowManager)context.getSystemService(context.WINDOW_SERVICE));
Display display = wm.getDefaultDisplay();
m_nDisplayWidth = display.getWidth();
m_nDisplayHeight = display.getHeight();
Shouldn’t this code place my image in the middle of the screen?
canvas.drawBitmap(m_circle1, (m_nDisplayWidth/2),(m_nDisplayHeight/2), null);
My image is located near the right corner.
Any help would be appreciated!
Use below code for placing image in center.
where
imageWidthis width of your image andimageHeightis height of your image.