I've got an android-device that allows a user to change the screen resolution. For instance, I have a 1080 display and I set its resolution to 720. I can verify that the resolution changed in the TV settings. However, it seems that Android doesn't use this information. Instead, it retrieves the physical display resolution and uses it. So it renders everything in 1080 and then it gets down-scaled to 720. It's a waste of resources.
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
Even though the TV tells me that the screen resolution is 720, I still get 1080 as the output of the code. Am I right with my assumptions?
How can I change this?
I know, that every Window is backed by a Surface and in principle I could change its size:
getWindow().takeSurface(new SurfaceHolder.Callback2() {
@Override
public void surfaceRedrawNeeded(SurfaceHolder holder) {
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
holder.setFixedSize(200, 100);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
}
});
But I get
java.lang.UnsupportedOperationException: Currently only support sizing from layout
Are there any other ways of changing resolution except creating my own Surface with arbitrary size (will it even work?)?