4

I have an Android app that I would like to display high quality images with. However there are many different screen sizes and ratios. I know there are filters to show apps in Market only for devices with small/medium/large screens.

If I put images of both sizes in 1 app it will double the size of the app, right?

Is it a good practice to make multiple versions for different screen sizes?

I would like to make 1 app in 3 versions for such devices:

  • medium screen mdpi
  • medium screen hdpi + large screen mdpi
  • large (tablets)

If it's possible to do it how can I specify them in manifests? Or is it somewhere in market?

yosh
  • 3,245
  • 7
  • 55
  • 84

4 Answers4

7

Android has a built-in mechanism for having resources designed for different screen sizes and pixel densities. It's called resource directory qualifiers, and you can read all about it here.

For example, for small screen sizes, you could create a specific layout file and place it in the res/layout-small directory. For a larger screen, you could create a layout file with the same name and place it in the res/layout-large (or res/layout-xlarge) directory.

For pixel density, you could create a small version of your image resources and place them in the res/drawable-ldpi directory (lower pixel densities). And for higher pixel densities, you could create alternate versions and place them in the res/drawable-hdpi directory.

I'd encourage you to read the page on Supporting Multiple Screens, and let Android help you out with its built-in mechanisms. Creating three separate copies of your app is harder for you to maintain, and it confuses potential users (most of whom probably neither know nor care about "pixel densities"). What's to stop them from downloading the wrong version of your app, and getting a lousy experience because of it?

Donut
  • 110,061
  • 20
  • 134
  • 146
  • I'm aware of the different res/size directories but how does it look when downloading app from Market? If I create a package of 20 MB with all resolutions and sizes included then every user will download whole 20 MB or just the the resources for his screen/hardware? Making 2-3 app versions visible in market only for devices with specified screen sizes would decrease downloadable app size. – yosh Dec 21 '10 at 10:44
2

As Donut mentions above android has excellent documentation for this here, here, here and here.

Note that all Manifest file changes and how to create one binary that will support different screen sizes, different densities AND different SDK's are at android website. But it requires careful planning and testing to do so.

The best way is to have ALL device configurations (listed here, including the Samsung Galaxy Tab simulater (large screen, hdpi) available here) in your development environment and test your app on them.

Community
  • 1
  • 1
omermuhammed
  • 7,365
  • 4
  • 27
  • 40
  • but if i have all device configurations inside 1 project won't the user download all resources for all devices? I would like to cover as many devices as possible but with small app size... Wouldn't it be better to post 1 app in few versions with such filters that all users will see only 1 app version on market? – yosh Dec 21 '10 at 11:59
  • He will be able to download all resources, but if you follow the guidelines in the links I posted above then you will see that you can reuse some resources (by having a default drawable folder, for example). In any case app size should not be a concern, with the processing power and disk capacity on android phones this is not an issue. Now if large number of resources is hurting performance then that is an issue, but it can be addressed with a bit of careful design. Android is one of the best and easiest platforms to develop for. – omermuhammed Dec 21 '10 at 17:30
  • the thing is why medium/mdpi user has to download both medium and high quality resources? :/ I have noticed imageview in android doesn't really scale down images very well. So I prefer to have different resources while not forcing user to download 2x the size of app cuz of this. – yosh Dec 22 '10 at 13:01
  • They did it because they didnt want developer to worry about creating different builds for different densities. On other platforms like J2ME that was a huge issue. Back in the day I have had to create dozens of builds just for one app, be thankful you dont have to do that. And from user perspective, if performance is not impacted he doesnt care if the apk has extra resources. – omermuhammed Dec 22 '10 at 13:39
2

No one seems to be addressing the file size issue you're really asking about, so I'll try.

You should package your high quality images as a set of separate downloads, one for each type of device you plan to support. This makes your base app small, and ensures the end user's disk space is only filled by images it needs.

I've not done this myself, but hopefully the idea will send you on the right search path. I imagine you design the separate download as either resources on your own server, or another set of apps in the market (i.e. "MyApp Image Pack HDPI", "... MDPI", etc.).

Josh
  • 10,618
  • 2
  • 32
  • 36
  • I wonder if there are some weird devices that can change screen density. Does the Atrix change density when used it in laptop mode? – Alex Jasmin Jan 09 '12 at 22:13
0

You have to create different .apk for each version and define this in your application's manifest file.use this link http://developer.android.com/guide/practices/screens-distribution.html

Ankit Dhingra
  • 125
  • 1
  • 5
  • When I asked this question 1 year ago Android SDK was half of what it's now and I already know the answer :) but thanks – yosh Dec 21 '11 at 12:11