How to handle very large drawable files in an Android Application - android

My client has given me very large resolution images for background and splash. He insisted that the quality of images should not be compromised.
He is looking to run application on Samsung Galaxy s5 and other small devices as well.
Now i have 17MB background image and other high resolution images as well.
I have read about hdpi, ldpi and other screen resolution android provided, but i am unable to understand if i put all these images in my drawabales then the size of my apk file will be so high.
Kindly guide me how do you manage high resolution images.

you can resize images as per the densities from android
link
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi

If you don't want your app to be heavy then you can put these images on the server and then load these images when the activity starts but for that you will be needing internet connection.

Related

Which devices are the set of six generalized densities used for?

The set of six generalized densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dp
From my understanding:
ldpi = Android watch wearable size devices?
mdpi = small/medium sized Android Phones
hdpi= Larger Android phones and small Android tablets
xhdpi = Medium sized and Large Android Tablets
xxhdpi = what for?
xxxhdpi = what for?
I want to create my app to work on Android phones and tablets only. So should I just create images in mdpi, hdpi, and xhdpi only and ignore the rest?
dpi has nothing to do about the physical screen size but it is all about the screen density.
DPI means for DOT PER INCH which mean that how many pixels there is in an inch.
Right now there is no device with ldpi and mdpi out there in the market anymore. My suggestion is to prepare all the images in xhdpi (x2) and if any specific image appears to not clear enough in high density phone, for example, Samsung Galaxy S8, xxhdpi one may be needed for that image as well.

Image resolutions for iOS and Android apps

I am creating an application in Xamarin forms both both iOS and Android which will also have images in it. I have two questions.
Can I have one image and use some API calls to modify the resolutions based on the device.
If not, what are the different resolutions needed, for targeting iOS and Android devices both phones and tablets
You certainly could, but this could slow down performance especially if you are loading a lot of images and need to resize often.
I believe it is better to pre-supply images at the correct resolutions. Both Android and iOS have good mechanisms for doing so and the way to do it is identical in Xamarin as in a native app project.
In iOS you can add an image set to your asset catalog for each image you will use and the three different resolutions for that image will go in that Image set, helping to keep things organized. There are no set resolutions, but you would want 1x, 2x and 3x versions where 1x is the "base" version that will be used on non-retina devices, 2x should be double the resolution of 1x and will be used on retina devices, where 3x should be 3x the res of 1x and (I believe) will be used for the 6 Plus and 7 Plus iPhone models.
For Android, it gets a bit more complex, but basically you provide multiple resource image folders (usually named "drawable" but can also be "mipmap") with screen density qualifiers in the names of the folders, e.g. drawable-hdpi or mipmap-hdpi. See this Android document for more info:
https://developer.android.com/guide/practices/screens_support.html
Here are the screen density qualifiers you can use:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
Again the actual size of the image is up to you, but the resolution of, e.g. the mdpi version would want to be ~30% larger that the version in the ldpi folder and so on.

Image resolution for activity background

I'm working on an Android app that should be compatible with most recent devices, Nexus and Samsung for example.
I would like to have a background image for the first activity, but I don't know what is the resolution for this image, as in Nexus there is a software navigation bar, but in Samsung mobiles there is a hardware navigation bar that is not taken into consideration.
What are the resolutions of the image that I should ask to the graphic designer if I want to put the image as an activity background ?
If you want your app to be compatible on most of all devices, you will need to have different resolutions. For a background image, the dimensions can vary for devices, that is why Android Studio has the capability to have mdpi, hdpi, xhdpi, and xxhdpi. Each of these fit different devices to support all devices.
Here is a breakdown of what each of these dpi ratings are:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi | Launcher icon only!
And, here is a breakdown of the resolutions for the dpi's:
320dp: Normal phone screen: 240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc.
480dp: Tweener tablet like the Streak: 480x800 mdpi
600dp: a 7" tablet: 600x1024 mdpi
720dp: a 10" tablet: 720x1280 mdpi, 800x1280 mdpi, etc.
My suggestion would be to make the best quality image, then use the tool below:
For the binaries for the tool, click here.
For the download, click here. (Download in .jar format)
For more information, click here. If this post has helped, please mark it as correct for future readers.

setting up dimens Nexus 5

my project currently just has one dimens file.. I know all my dimens look good on a nexus 5 which i believe has a dpi of 445 and a dpx of 3. My question is does that make it mdpi, hdpi, xhdpi? I am asking as i want to use this as the standard when i go ahead and make my other dimens files.
according to this graph: http://i.stack.imgur.com/1NXYH.png
that would make it xxhdpi which seems wrong to me, especially since our dimens seem really small on a tab 4 which has a much bigger screen than the nexus 5.
A set of six generalized densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
Since Nexus 5 has pixel density of 445 therefore it is xxhdpi
Read this android developer link
Also have a look at this question

Android Screen Densities: how many densities?

I am developing an Android app that downloads images from an S3 bucket and displays them full screen on the phone.
How many different densities should I create in the S3 bucket for each image, in order to include both phones and tablets?
What about for Apple devices (again, both phones and tablets)?
Note: I have read the Android Supporting Multiple Densities help page. I have also found similar questions on Stackoverflow, but they are 3-4 year old and new devices have popped up since then.
Thanks!
You could include one of them or all of them, that depends on how many densities you want your images to look good. The answer to this question depends on how much you care about it. If you don't care and just want it to work, add only one.
For Android you have:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
And for iPhone:
normal
#2x
#3x

Categories

Resources