Now I have an ImgeView which a circle and I want to find the center point of that circle so I have tried the following code but it seems not working
int location = new int;
int center=new int;
I assumed below situation:
You will be loading an ImageView(either from xml or code) and have a reference to the same in myImageView(say). Now, you wish to calculate the centre of the myImageView irrespective of its position on the screen.
If my assumption is correct then probably below is the solution you are looking for:
int centerXOnImage=myImageView.getWidth()/2; int centerYOnImage=myImageView.getHeight()/2; int centerXOfImageOnScreen=myImageView.getLeft()+centerXOnImage; int centerYOfImageOnScreen=myImageView.getTop()+centerYOnImage;