Dealing with DPI and resolution - Android Q&A, Help & Troubleshooting

Hello, I'm a beginner for android development, and I am currently making a game for Android, but I've been stuck on this problem for a few hours.
Since android's resources (drawable, mipmap) are based on DPI, if I want to fill a screen with a specific resolution, how would I go about adjusting the size for multiple displays?
For example, I have a 1920x1080 screen, so I make a background that is 1920x1080. If I try the app a 1280x720 screen, the image will be clipped and some of it will not be visible on the screen. If I try the app on a 2560x1440 screen, the image will not cover the entire screen.
How would I make my app work with phones with different displays? Or have I misunderstood the mdpi,hdpi,xhdpi,..etc. and they in fact actually deal with resolution?
I am using SurfaceView and BitmapFactory to load the resources and load it onto the screen, if that helps anything.
Many thanks.
(If I am posting on the wrong subforum, please direct me to the proper one, Android Software Development seemed to be full of guide and not help, so I decided to post here)

Related

[Q] Resolution of background image?

I want to replace the background image on my X10 mini pro (MiniCM7-2.1.8) with a photo, and now I am wondering, which resolution I should resize the image to.
This can't be such a stupid question after all, I tried to read up on the issue, but looks like a lot of people have problems understand how Android handles background images.
So the background image is panned across all homescreens (5 of them in the standard setup of MiniCM7-2.1.8) in a unique way, so the used background image can not just be as large as the physical display resolution.
Somewhere it was mentioned, the picture should be twice as wide as the physical screen, but I am not sure, if this really applies.
As the X10 mini pro has a 240x320 display, what has to be done, to use a photo which does not get cropped or stretched?
And how to overcome the problem with the display orientation, so once it fits for the 240x320 orientation, what happens when the phone gets turned resulting in the 320x240 orientation?
Master One said:
I want to replace the background image on my X10 mini pro (MiniCM7-2.1.8) with a photo, and now I am wondering, which resolution I should resize the image to.
Click to expand...
Click to collapse
1 homescreen 480x320, 1 image 240x320 on the center
2 homescreens 480,320 2 images 240x320
.
.
.
MiniCM7-2.1.8, sorry
View attachment 894453
View attachment 894454
Master One said:
I want to replace the background image on my X10 mini pro (MiniCM7-2.1.8) with a photo, and now I am wondering, which resolution I should resize the image to.
Click to expand...
Click to collapse
You don't need to physically resize image to set it as wallpaper. You can set one image as wp in many ways from default wp handler. ''Needed'' resolution is relative thing because of different number of home-screens that users have on their phones. Android handles this thing quite well.
Sent from my U20i using XDA App
For reference, the background picture needs to be 480x320 independent of the number of home screens.
So for any Android phone, it's always 2x horizontal and 1x vertical screen resolution.
It makes sense to prepare the picture in advance, because obviously it consumes less memory and can be used without cropping.

[Q] Actual Screen size

What is the exact screen size I should use while developing apps for Prime ?
Declared screen resolution isn't correct, because I used that and tested and its not showing in full size as it should, so it must be some other screen size.
Don't know, but would it work to take a screen shot and mail yourself the photo?
I had the same trouble with my hubs screens. Beautiful Photoshop stuff, but when they display at the original (advertised) size, they have a few pixels missing at either end.
I've used 1280x800px, but width of 1280 won't go to their ends and height seems to be shorter, because I see font degradation and rest of the objects, but its best visible on fonts (at least in my case.)
I'll have to explore tomorrow with different sizes... although I don't like these testing where I have to do whoknows how much of them to find exact dimensions.
The system bar take 48 pixels. So the actual resolution that's is available is 1280x752
If you going to create a app. I why don't look at android developer section for guide and info.. Just a suggestion...
http://developer.android.com/guide/practices/screens_support.html
http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts
Asus Prime & Tapatalk
Both of your links don't mention 752px, there is 720.
Anyways I don't use Android SDK or any other of their info. I use Adobe Flash and do it all from there. Very easy and no need for lots of reading

[Q] Decrease Resolution for Gaming?

Hello Tablet Z community,
This is my first post in this devices forums since getting mine last week. It's a great device, love it, etc.
I've never owned an Android device with a screen resolution this high so I've yet to encounter this problem - some of my games (specifically the emulator PPSSPP) have relatively low framerates (compared to my less powerful Samsung P6810 @ 800x1280). I know with computers in particular it's trivially easy to change resolutions in games/the OS, especially to increase FPS but I've never seen a method to do this on Android and Google searches turn up people mentioning device resolution without changing them.
Does anyone know if it's possible to, ideally, force a different resolution for a particular application? A less than ideal solution would be a system wide change but I would be willing to endure temporarily to increase FPS.
Any advice and suggestions would be greatly appreciated
I would be interested to know about this, iv just loaded ppsspp however havent been able to play any of the playable games listed, I did see a few videos of the xperia z playing well, however that has the same resolution and specs.
juzza87 said:
Does anyone know if it's possible to, ideally, force a different resolution for a particular application? A less than ideal solution would be a system wide change
Any advice and suggestions would be greatly appreciated
Click to expand...
Click to collapse
That was recently discussed in this thread: LCD Density Changes and Results (With Pics)
Cat McGowan said:
That was recently discussed in this thread: LCD Density Changes and Results (With Pics)
Click to expand...
Click to collapse
This is very different, setting the DPI to a non-stock value just resizes the userspace, the resolution is fixed and unchangeable as the OP is thinking. Compared to a Windows PC where you can change the resolution, in Android you only have the ability to change the dpi, which states how large the pixel-to-screen size is. A smaller number indicates a smaller pixel-to-screen size, meaning the information shown on screen is sized for a laeger screen (making it smaller, since the screen is a fixed size). And a larger number has the reverse effect. Android UI guidelines set the optimal dpi for resolution vs. screen size, to mainain a similar experience across devices (similarly sized icons and fonts, etc). Again, this has nothing to do with adjusting the physical resolution of the device, which (to my knowledge) is not possible in Android.
daveid said:
This is very different, setting the DPI to a non-stock value just resizes the userspace, the resolution is fixed and unchangeable as the OP is thinking. Compared to a Windows PC where you can change the resolution, in Android you only have the ability to change the dpi, which states how large the pixel-to-screen size is. A smaller number indicates a smaller pixel-to-screen size, meaning the information shown on screen is sized for a laeger screen (making it smaller, since the screen is a fixed size). And a larger number has the reverse effect. Android UI guidelines set the optimal dpi for resolution vs. screen size, to mainain a similar experience across devices (similarly sized icons and fonts, etc). Again, this has nothing to do with adjusting the physical resolution of the device, which (to my knowledge) is not possible in Android.
Click to expand...
Click to collapse
Heh. Thanks for the schooling, but it was unnecessary, I didn't just fall off a turnip truck.
Thanks for the replies guys, at least now I know for sure..

[Q] Zoom level on FHD devices, not the same as in a FHD laptop. Why?

I wish I could get some clarification from the experts here.
Sorry if I didn't pick the most suitable forum to raise my question.
With displays resolution increasing on high-end android phones (now FHD) and some tablets too, I'd expect the browsers to take advantage on that.
Although this is some thing where I can't see any progress even with the newest hardware.
The same webpage as seen on a FHD laptop, or on a FHD smartphone, doesn't show the same thing.
The minimum zoom for a smartphone seems to be set in such away that a significant part from pages with most content is cut, in respective to what's seen on a FHD laptop.
Some could argue that once the smartphone screens are much smaller, it doesn't make sense to have same zoom level settings as it won't be readable. Although smartphone screens are getting bigger, and many tablets have big enough displays to show it in a different and still readable way...
Furthermore in many cases if you turn a smartphone in portrait or landscape you can see exactly the same content displayed wide-wise, which doesn't make any sense.
Landscape mode could make better use of the larger horizontal display resolution and show additional content.
I've tried many browsers on Android, but all seem to show the same limitations and no settings to decrease the default zoom level, neither it is possible to manually zoom-out further in any way.
Does anyone knows if this is an Android OS limitation and when this foreseen to improve, or if there is some browser that gives further control on the minimum zoom level?
I should say this has been the main reason why I've not seen a justification to change my device for a new one with better HW and larger screen...
The browsers on my qHD device, show exactly the same thing as the newest FHD ones.
Thanks in advance!

Changing resolution blocks screenshots

@duraaraa any info or direction that you can provide on this?
I upped the resolution from stock 1080x2160 to 2160x4320 and left dpi at stock so I can have more screen real estate and still have a comfortable viewing experience. The issue I'm facing now is, I cannot capture a screenshot I get an error.
System UI
Couldn't Capture Screenshot
Screenshots are not allowed by this app or your organization.
steps to reproduce:
up your resolution to 2160x4320 and take a screenshot
Any guidance would be appreciated.
webleeper said:
@duraaraa any info or direction that you can provide on this?
I upped the resolution from stock 1080x2160 to 2160x4320 and left dpi at stock so I can have more screen real estate and still have a comfortable viewing experience. The issue I'm facing now is, I cannot capture a screenshot I get an error.
System UI
Couldn't Capture Screenshot
Screenshots are not allowed by this app or your organization.
steps to reproduce:
up your resolution to 2160x4320 and take a screenshot
Any guidance would be appreciated.
Click to expand...
Click to collapse
Sorry, don't know. Probably issue related to rooting and the settings you changed.
Thanks for the quick reply but I'm not rooted.
webleeper said:
@duraaraa any info or direction that you can provide on this?
I upped the resolution from stock 1080x2160 to 2160x4320 and left dpi at stock so I can have more screen real estate and still have a comfortable viewing experience. The issue I'm facing now is, I cannot capture a screenshot I get an error.
System UI
Couldn't Capture Screenshot
Screenshots are not allowed by this app or your organization.
steps to reproduce:
up your resolution to 2160x4320 and take a screenshot
Any guidance would be appreciated.
Click to expand...
Click to collapse
Mate 10 pro panel is only 1080p to begin with,
In what way did you upped the resolution ?? The setting wont give you that resolution option.
otonieru said:
Mate 10 pro panel is only 1080p to begin with,
In what way did you upped the resolution ?? The setting wont give you that resolution option.
Click to expand...
Click to collapse
no need for root or settings to change DPI or Resolution
adb shell wm size 2160x4320
adb shell wm overscan reset
webleeper said:
no need for root or settings to change DPI or Resolution
adb shell wm size 2160x4320
adb shell wm overscan reset
Click to expand...
Click to collapse
uh... well... you already understand that this method is "only faking" the number for the app to think that it run on that size of screen right ? Hardware & stock OS wise, the limitation is still on 1080p
I dont think the system UI app of EMUI 8 itself was made to handle that number
Normal 4K itself is only 3840 x 2160, and i dont think i ever found any phone running 4K+ (18:9)
This is just like asking why sometimes the play store act weird when we change our DPI
So answer is that : because it simply didn't support it
I've done #wm size 720x1280 & wm density 320 to 720p screen for long battery life. and I found the system's screenshot can not take whole screen(720p one).
It looks like the screenshot component take a 480p screen and the same 720p adjusting on AEX 5.x is fine.
so I thought maybe the screenshot on pie still mistake 720p screen for 1080p screen and take a 480p picture(expect: 1080p x 720/1080 = 720p, but now: 1080p x 720/1080 x 720x1080 = 480p)
But I notice that keep wm size 1080x1920, whatever which density(320 480 240)I've set, the screenshot could take a complete screen picture. while I change density, whatever resolution (720x1280, 480x800, 1080x1920), screenshot just take the top left part of screen...
partial screenshot is same condition , take a top left part of what I selected .
the screenshot on different resolution is the last issue I can found on AEX 6.0, which not contain on AEX5.x(maybe this is pie issue but still expect you can fix it) if I don't need change the resolution, the ROM is PERFECT?
can you fix this ?? thxxxxx a lot
XDrz said:
I've done #wm size 720x1280 & wm density 320 to 720p screen for long battery life. and I found the system's screenshot can not take whole screen(720p one).
It looks like the screenshot component take a 480p screen and the same 720p adjusting on AEX 5.x is fine.
so I thought maybe the screenshot on pie still mistake 720p screen for 1080p screen and take a 480p picture(expect: 1080p x 720/1080 = 720p, but now: 1080p x 720/1080 x 720x1080 = 480p)
But I notice that keep wm size 1080x1920, whatever which density(320 480 240)I've set, the screenshot could take a complete screen picture. while I change density, whatever resolution (720x1280, 480x800, 1080x1920), screenshot just take the top left part of screen...
partial screenshot is same condition , take a top left part of what I selected .
the screenshot on different resolution is the last issue I can found on AEX 6.0, which not contain on AEX5.x(maybe this is pie issue but still expect you can fix it) if I don't need change the resolution, the ROM is PERFECT
can you fix this ?? thxxxxx a lot
Click to expand...
Click to collapse
Who is gonna fix what? Just use the phone the way its supposed to be used i dont understand what you are doing and why. If anyone, huawei can fix your issue i guess.... good luck talking to them.
You should read this, particularly the long answer near the top which explains the size vs density changes.
https://stackoverflow.com/questions...to-use-adb-shell-wm-to-simulate-other-devices
I think this is actually a bug in android pie. My phone has a 4k display, but normally uses HD res unless in gallery app. So I changed wm size and density to match the display (and despite what some other say, this actually changes the visible resolution, IF your display has this many physical pixels).
Screenshots worked worked fine in oreo, but after updating to pie, there are black borders on the picture.
Display
Spodi2290 said:
I think this is actually a bug in android pie. My phone has a 4k display, but normally uses HD res unless in gallery app. So I changed wm size and density to match the display (and despite what some other say, this actually changes the visible resolution, IF your display has this many physical pixels).
Screenshots worked worked fine in oreo, but after updating to pie, there are black borders on the picture.
Click to expand...
Click to collapse
No Huawei phone has a 4k display, this whole thread is a waste of space really, guy setting his phone display to something that is not supported and wondering why his screenshot won't work, damn mate 10 pro is 2160x1080 and can't be any more than that, if the problem was the screenshots not working in a supported mode there might be a reasonable and were but as it stands this thread should be closed and deleted
revjamescarver said:
No Huawei phone has a 4k display, this whole thread is a waste of space really, guy setting his phone display to something that is not supported and wondering why his screenshot won't work, damn mate 10 pro is 2160x1080 and can't be any more than that, if the problem was the screenshots not working in a supported mode there might be a reasonable and were but as it stands this thread should be closed and deleted
Click to expand...
Click to collapse
The whole point of my post was more like: its not a Huawei only "bug", but effects all (or at least most) pi phones with a custom wm size set. Maybe I was beating around the bush too much... :angel:
Spodi2290 said:
The whole point of my post was more like: its not a Huawei only "bug", but effects all (or at least most) pi phones with a custom wm size set. Maybe I was beating around the bush too much... :angel:
Click to expand...
Click to collapse
Hi, have you found any solution for the screenshots when you change the screen resolution? You're right it happens only in pie and with different phones, in oreo the multitasking previews resize when you enter to the app but the screenshots are ok, in oreo the previews in multitask are ok but the screenshot miss a part of the screen.

Categories

Resources