About setting images which are large enough for any android devices - android

As far as I googled about it, in general, you provide several images with different scales and put each image into folders like ldpi, mdpi, hdpi and so on.
The question is if there are any problems with that I provide a image with only one scale which is large enough.
Using 'dip' it resizes the images smaller for several device resolutions.
Hope my question makes sense.

No, as long as it is a vector image you should be fine

if you using bitmap image yes you should provide several image with different resolution but if you have no problem with bad quality image when it forced to be streched to big resolution no you didn't need to provide it.
for showing the image in the device I prefer measuring the device size (width and height)
then scale it programatically
I think this should be enough, but if you have some other question about this topic feel free to ask in the comment :)

Related

Can I keep fix the same resolution of the same image when the devices have different densities?

I asked a question yesterday.
Why do resolutions become smaller after a image file be read by program?
Very thanks the people helped me.
They let me know that if I use the devices having different densities, the resolutions of the same image may be changed.
For example:
I have a image with resolution 1440x2560 and a device with density 3.5.
The revolution will become 1260x2240 after the image be read into the program.
But I don't want the resolutions of the images to be changed, because the proportion of the images on the screen will be different.
I tried to find a solution, but I failed.
Is there a convenient way to fix the same resolution of the same image on the different devices with different densities?
If you want your images to be adjusted by Android, I understand they are drawables even if you didn't explicitly mention it, add them to the drawable-nodpi directory.

Android drawable sizes for different screens

I've read a lot of different posts and articles about how screen sizes are determined and it's pretty confusing to say the least so I thought I'd just ask!
Here are the facts:
I have developed an app that has a big logo on the login screen. This logo is 958x496 and is 30.6KB. It's a real nice big sharp looking image!
I have four development phones that each use different drawable sizes ranging from hdpi to xxxhdpi.
I currently have a dawable-nodpi folder that has the logo in and every phone uses it but I feel like this isn't the 'proper' way to do it so I'm trying to have different sized images for each phone.
So, I want to use this full 958x496 image as the baseline for the xxxhdpi drawable and I will scale them down accordingly using the 3:4:6:8:12:16 scaling ratio (meaning the full image will be my '16').
As it currently stands if I do that, for the hdpi phone I get an image that is 354x183 as its roughly 37% of full size. I run up the app and yes the logo looks great but here is the question.. if I use drawable-nodpi instead it will use the full 958x496 image and it looks better so why should I downsize my image when it will look slightly blurry? Why not just use the best possible version of the image? I thought this was because I wouldn't get the benefits of the high quality image on the lesser phone, but you can definitely tell a difference.

Image Folder xxhdpi/xhdpi/hdpi/mdpi/ldpi

Hi Guys And Ladies and the Others,
I develop a project. It have a lot of images. And it just run on 4.0 and above device. So If I resize all of images to xxhdpi, xhdpi blabla, the size of application became very huge. If Am I just create 72x72 (hdpi size), is it just enough ? Or do you suggest anything else ?
Thanks a lot for the answer..
The proper way to do it is to have different bitmaps for each density. This is because high density images are ideally not just high resolution copies: they're custom designed with more detail in. Also, low density devices tend to be underpowered, and so have a hard time scaling down high resolution images.
It does depend on your application and your needs, though. You might find that your application runs at a decent speed, and looks OK, with just one image of each type.
Something else you should consider is whether you can use vector graphics for some of it, or a ninepatch, which will scale automatically.
Lower quality images end up getting stretched on higher resolution screens, which can look pixelated. If you need to cut down on images, there are a number of approaches that I would suggest:
Consider the format. If you need a rasterized image, does it need to be a PNG rather than a compressed JPEG image, for example? Can you get away with using an SVG (which would allow you to support all sizes and resolutions using a single image asset)?
For rasterized images, consider whether you can tune the compression ratio.
Try supporting the highest resolution, and then skip a few resolutions in between and provide some lower resolution images for lower resolutions where details appear lossy or where you seem to be getting a performance hit from downscaling the high resolution image (that is, xxhdpi will probably be fine on xhdpi and hdpi, but then you will likely want to provide separate mdpi and ldpi images).

Android Image Size Limitation

So I seem to be running a problem on an Android program I'm writing. I'm still a noob, so please help me out understanding the problem and how I can solve my issue.
I'm creating a simple game and I'm doing all of the graphic designs for it. My images are 1024x1024 or 1024x512 with a resolution of 300 pixels/inches. Yes, I understand that I'm probably over doing it. I just want the graphics to be really clear and to look good. All of the graphics are in the drawable folder not in hdpi, ldpi, mdpi, xhdpi or xxhdpi drawable folders. Now, the problem I'm having is that my app was working fine until I added one more 1024x1024 image to the drawable folder. Now the app just crashes as it tries to load an image. The problem I get is memory over flow. It doesn't matter what activity is running, it seems that once it hits a limit of loading images it crashes. I read the android resolution page http://developer.android.com/guide/practices/screens_support.html but maybe my English is not good enough to understand.
Should I resize the images to each resolution (hdpi, ldpi, mdpi, xhdpi and xxhdpi)?
When I move from one activity to another activity in my app, do I have to clear the ImageViews in the previous activity to clear up memory?
Please help me understand how this work.
Thanks
David
Ironically, the method you're using is probably making your images look worse.
When you place raster images in the root drawable folder, they are assumed to be mdpi, and will be scaled up for the other densities. This means that your 1024x1024 bitmap is scaled up and pulled in as a 2048x2048 bitmap (which in most cases is far larger than you probably need). So yes, your best bet is to make the images whatever size they need to be for a particular density, and create separate images in each drawable folder that you need to support.
Also to note, it doesn't matter what resolution (you mentioned 300 ppi) you set your images to, the only thing that matters is the pixel dimensions.
I think you got vm budget out of error.I faced this problem while working on my previous application. After searching i found solution from developers guide ... fallow this link hope it solves your problem.Thanks

Should I create resized images for all drawable folders (ldpi-mdpi-hdpi) if the image is the same?

If the image is the same but only resized, should I create (resize) all the images? Or let the system resize the images for me and only ship the app with hdpi images?
For me it makes sense to create new images if the images are different, for example, if the resized image doesn't fit into a ldpi screen then another image needs to be created with less information.
Am I going to run into memory issues on small devices if I only ship apps with hdpi images?
Thanks!
I think you should use specific drawable for each type of screen. By doing this, you are sure that the UI is the same in each screens.
I don't know if you already read this but here is a good article that explains the best way to support multiple screens http://developer.android.com/guide/practices/screens_support.html

Categories

Resources