I am making a game that displays animated characters on the screen Now I am at the stage where i want it to display correctly on other devices as well increase the screen resolution on my own device and have it still display correctly for this I want to get the scale factor so I can change all my pixel values to DP values however the display metrics does not change no matter what I change the screen resolution to
for example
this.getHolder().setFixedSize(1024, 768);
scale = getResources().getDisplayMetrics().density;
DisplayMetrics dm = new DisplayMetrics();
((Activity) getContext()).getWindowManager().getDefaultDisplay()
.getMetrics(dm);
float xDpi = dm.xdpi;
float yDpi = dm.ydpi;
Now no matter what I change 'setfixedsize ' to, both xdpi and scale stay the same even though it does show the increased screen resolution on the display