I am writing a drag and drop application and got really confused because of some parameters.
Please help to figure out.
First of all, I read the documentation fo
All these measurement methods return sizes in pixels( px
), not density-pixels ( dp
). If you want to convert it you can get the density by calling:
float density = getResources().getDisplayMetrics().density;
And then divide the values you get with the provided density, for example:
int widthDp = (int)(img.getWidth() / density);