Reputation: 24666
I'm planning to develop a very simple application (my first Android application) and I'd like to run it both on smartphone devices and on tablets.
I know that there are a lot of Android versions and, if I'm not wrong, 3.x and 4.x are designed only for tablets.
So my question is: should I develop two different version of my application? Is there some guideline to follow for development on different devices?
Upvotes: 0
Views: 2960
Reputation: 141
You will understand everything you need in the Google Developer Guidelines which link just has been posted, but the concept is quite simple. Android runtime will automatically search for the best layout files to fit the needs of your current device (density, screen size, etc.). The decision will be done by the names of the layout folders you've specified.
So let's say on an Android 4.0 project you have only one default layout folder layout
specified. You're already ready to deploy it on both phones and tablets and they will use layout files from the layout
folder.
However you can create another folder, for example layout-sw800dp
. Devices with a screen width of at least 800 pixels (such as tablets) will now search for your layout xml files in this folder first (e.g. main.xml
). Only if the layout files can not be found there, it will try to find them in other layout folders.
This Google Developer Guideline will help you will all the further details you need.
Upvotes: 0
Reputation: 17930
You mentioned your application is very simple. I don't know what is your web development background, but if you have some (HTML,CSS,Javascript) you must check Phonegap. Its much easier to develop in phonegap, and you get multiple devices support.
Upvotes: 2
Reputation: 6201
For different device, Java code are not change . Only need different layout for different layout.
Check the
Thanks
Upvotes: 0
Reputation: 12587
what you should do, is develop one app with different UI for the different devices. you can read this awesome google article about supporting different screen sizes.
this way you'll be able to write the app once, and use different screens for the different devices.
Upvotes: 0
Reputation: 12642
4.x
is for both mobile and tablets.
3.x
is only for tablets.
you can read http://developer.android.com/guide/practices/screens_support.html
Upvotes: 1