Android loading in images of with different dpi, some do not appear - android

I'm loading external images from a url, which they are all the same resolution. However, the images that are below 100dpi do not appear. The rest are 100 dpi and they do appear.
I can't wrap my head around this dpi resolution concept, and why I can't use these images even though they are the same resolution at the others.
I've added two test images. Could someone try to add these images externally to imageViews? I want to see if you are able to display them.
http://bloggr.geespot.ca/offbroadway-poster.jpg
http://bloggr.geespot.ca/eppleworth.jpg

Well it looks like dpi was not the issue after all. The cause was probably the way it was encoded, which I'm not sure how it was done. But I ran it through photoshop and all is fine now.

Related

Android drawable: different densities or scale

I have designed an in-app keypad for my Android application and I need to provide an image for every key. Currently I've only loaded one large image for each one that is being scaled down to adjust to the layout. Also, this looks nice in every resolution.
Is this approach acceptable or should I provide different images for different screen densities? Currently I've placed those inside the generic drawable directory.
You should. Some mobiles with lower resolution, usually won't have much memory. Loading large images in small screen takes too much memory, which might end up crashing. So if you give different images, then according to density it will take appropriate images. check this out.
It's acceptable in some cases but certainly not optimal.
For best memory performance and the least amount of artifacts I would still recommend to provide alternative bitmap resources for different densities, like the Android documentation recommends.

How to support multiple devices with many pictures in application?

I saw many questions like these and read many docs, but I'm still not sure what is the proper way. I have application with 500 photos, and first how I was doing it was to scale every photo 5 times, to the pixel sizes for each ldpi, mdpi, hdpi, xhdpi and xxhdpi. But, after doing this, application got much bigger than it should have and since you can only upload .apk with 50MB to market, I found myself in trap.
I found several options which can be made here, but not sure which is the proper one:
Make a multiple layouts for each of this densities on devices and scale with different dp's in them
Make multiple .apk files, each for every device with different densities (still, Google is making accent on this option to make it only if you really can't make it anyhow else - why is that? this would be perfect for me, since I already have photos prepared for each density)
Make multiple pictures and put it just in one .apk - this can't work for me, since the .apk is too big
Make pictures which are good for MDPI device, put them in "drawable" and they will automatically resize bigger for other devices and smaller for smaller density devices - this makes problem since pictures, when they're being resized from MDPI to other bigger dpi devices, pictures are blurry.
So, anyways, proper way of handling this would be to follow first option, am I right? I should just take xxhdpi pictures (so they're always scaled from the best picture), put them into drawable-nodpi? However, I have some problems with scaling on ImageButtons.
Please, tell me how to make it properly.
My practice is using only one apk to keep the app simple and easy to develop and publish.
Use only one drawable, the high the better. it depends the final apk size you(market) can bear.
May be this question will help:
Only use XHDPI drawables in Android app?
An addition to the Loki's answer. You could resolve the poor perfomance on small scale devices making a cache folder for images. Downsize the image the first time the device loads it, according to the density of the device, save it to the cache folder, and the next time use the cached image.
Bonus if you make this in an batch process in the background!
I don't know but could this be done as an update to the app. You download a plain vanilla app that prompts the user to upgrade, or just does it automatically.sounds like something Google needs to improve on. When I download an app I only need one app for one language one device.sounds like Microsoft mentality

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

stretch images for Android devices

I have been programming an application for Android. I want to target it for more devices(tablets, smartphones). I tried to find some info at http://developer.android.com/guide/practices/screens_support.html but it does not work correctly.
I want to automatically stretch images on different devices, not only in my testing device. I draw images for the mobile full screen (which has the same resolution as my mobile). But, for example in the tablet it draws incorrectly. I tried to change the size and it gives several folders(lhdpi, small, ...). When I tried to start it again in the tablet, it was bigger but still incorrect (there was a black space on the edges). I have several images in my application, and I want to retain the same size as in the mobile too. Please, help me.
Sorry for my spelling mistakes.
you have to maintain aspect ratio at your own . don't put same sized images in all folder (hdli, mdpi, ldpi), if this was the case they think why android provides different foldes ? put images in ratio 0.75 : 1 : 1.5 . it will work .
additionally read about 9-patch images, this will make your life much easier .

Scaling images automatically instead of pre-defined images

I'm quite new to Android development. My understanding is that you can create several versions of the same image with different sizes and put them into the folders drawable-ldpi, drawable-mdpi, drawable-hdpi.
It seems obvious to me that you can handle this problem "the lazy way" by just resizing one image depending on the device's pixel density. For this I programmatically find out what density the device has, like ldpi. The implementation itself is not the problem. I'm just afraid of any drawbacks (that prevent me later from running the app on different devices).
So, are there any (major) drawbacks of scaling images automatically ?
In which of the three folders do I put the image so that the compiler can find it?
You would put the image in your regular drawable folder. That way any phone can find it.
While you can programatically shrink images, shrinking usually has the effect of reducing image detail and causing jaggies.
Adding in smaller assets will also reduce memory usage on smaller phones. Keep in mind that some Android phones are notoriously bad with memory (see: HTC Status), so any and all savings help.
I would recommend just photoshop scaling images down large images yourself. For smaller images, it is not as big a deal.
Android does auto-scale and it works fine in some cases, but it doesn't work for many, notably small images with important details like text. Scaling a larger image down blurs those details. Scaling a smaller image up is worse. This is why icons files have been multi-resolution since the very early days of GUIs. To wit, text scaling is hugely complicated. Ask any font designer, and note Adobe built a company on algorithms to do it automatically.
it's on mdpi folder. It'll change the size automatically. But is not recommended since the image quality drops.

Categories

Resources