0

If I make an android app using android 2.3.3 and after completion i make it work for other devices, is this a good idea ? Because i have not developed app for multiple screen sizes. Would it be more time consuming ? What precautions I would have to take ?

Khurram W. Malik
  • 2,660
  • 2
  • 20
  • 27
  • Google tells Android developers to ["think like a web designer"](http://android-developers.blogspot.com/2011/09/thinking-like-web-designer.html). This is key for creating flexible layouts that fit into any screen size. The currently most elegant way to do that without too much effort in the long run is making use of fragments, because you can think of them as being GUI components that are roughly the size of a phone screen. Then you can take two of them next to each other for tablet sized screens. Just for giving you one idea. – tiguchi Jul 02 '12 at 21:04
  • yes but fragments are for tablets write ? I have to make it run on all devices :/ – Khurram W. Malik Jul 02 '12 at 21:22
  • No, fragments are for any Android device since API level 11 and you can use them on older versions using the [support library](http://developer.android.com/reference/android/support/v4/app/Fragment.html) which can be installed into your existing Eclipse Android project by right-clicking it -> Android Tools -> Add Support library... – tiguchi Jul 02 '12 at 21:27

3 Answers3

1

I think you should do more research from your part, but here is a link to get you started.

http://developer.android.com/training/basics/supporting-devices/screens.html

0gravity
  • 2,682
  • 4
  • 24
  • 33
1

The best place to start this kind of research is with Google's Android Development website, which has tons of helpful guides and resources. Here are two links which may help you with your problem:

http://developer.android.com/guide/practices/screens_support.html

http://developer.android.com/training/multiscreen/screensizes.html

And another which discusses layouts. The Dev Guides have a bunch of mini-tutorials to teach you how to use and the differences between many views.

http://developer.android.com/guide/topics/ui/declaring-layout.html

On the whole, you should definitely start coding with multiple screen sizes in mind, although this goes along with just having good android coding practices. In general, get acquainted with the xml attributes that start with android:layout_ for example android:layout_width and android:layout_weight and the way your image resource folders need to be managed. In my experience, once you get comfortable with how layouts work on Android, making sure they work over multiple screens will come easily. Having a basic understand of it before get in too deep in will save you a lot of headache and recoding later. Don't be afraid to make simple apps to test different layout techniques you're learning. Good luck.

MattDavis
  • 5,158
  • 2
  • 23
  • 35
  • This stuff is helpful but can you take a look at this link and tell i really have to make these much XML files and if so what will be the difference while writing them ? – Khurram W. Malik Jul 02 '12 at 21:17
  • The xml file is the standard way of defining your layout in android. You'll usually have at least one per screen, with others defining any reusable widgets you'll need. They make things easy to style and change. While you can create an app by defining all of your views dynamically, trust me that this will make this very confusing and lead to lots of headscratching bugs and imperfections that are not easy to debug. – MattDavis Jul 02 '12 at 21:23
  • [link](http://stackoverflow.com/questions/8530914/how-to-i-develop-android-application-to-work-in-different-screen-resolutions) – Khurram W. Malik Jul 02 '12 at 21:29
  • [link](http://stackoverflow.com/questions/8530914/how-to-i-develop-android-application-to-work-in-different-screen-resolutions) i asked about this link , please tell if this is helpful – Khurram W. Malik Jul 02 '12 at 21:35
  • No, you can make one single layout to work across all screen sizes. However, you may find your a special layout file makes your app look better when dealing with higher density or tablet sized screens. – MattDavis Jul 02 '12 at 21:43
0

First decide on the minimum SDK version you are willing to support (let's say minSdkVersion="8" for example).

Second, build your application against Android 4.1 and set your targetSdkVersion="16". Doing so will allow you to make use of some of the prettier UI features (i.e. Holo themes) on newer devices.

Third, test your application extensively using the emulator on devices running SDK 8 through 16. If you make any method calls from the newer APIs, make sure you prevent older devices from invoking these methods (as they will not be recognized and will crash your app at runtime). At this point you can optimize your application for different screen sizes (i.e. phones and tablets).

jotik
  • 17,044
  • 13
  • 58
  • 123
Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
  • [link](http://stackoverflow.com/questions/8530914/how-to-i-develop-android-application-to-work-in-different-screen-resolutions) take a look at this link and kindly tell that if I have to make these much XML files what difference will be in there in each file ? – Khurram W. Malik Jul 02 '12 at 21:18
  • Yes you can. Use the Android support package. http://developer.android.com/tools/extras/support-library.html – Alex Lockwood Jul 02 '12 at 21:27