Question

I'm developing an application recently and had been researching. I first programmed my android application in 4.1.2 API which is the API for Galaxy S3. But today, because I made a mistake, I restarted programming with fresh new mind. So I was researching with what platform I should program with, such as API and devices. That way, I could perfectly fit the height and width of my components for my xml blue print. But one thing that I noticed through research was other programmers program in 2.3.3 even for Galaxy S3 as long as the wXh ratio is okay for the device. So, API level really doesn't matter? So...I want to know why API doesn't matter as long as wXh ration is okay. And a fine(perfect, actually) virtual device and API for an application for Galaxy S3

Was it helpful?

Solution

It is not all about the height and width of device. Android layouts are not static and you are not supposed to give a fixed height and width to your application interface. Rather you should use layouts specifying as wrap_content or fill_parent type of relative sizes so that they fit into all devices.

Further, you should specify layouts for low, medium and high density screens so that it can behave properly in most of the devices.

Now to the API version, as a developer, you should try to ensure that maximum people can use your app. You will want to ensure that your application can run on devices that have version 2.3.3 installed as well as ICS installed. In order to achieve this, it is advisable that you develop targeting 2.3.3.

OTHER TIPS

API level matters. You can use API for Android 4.1 for Samsung Galaxy S3 but programmers use (as you said) API level 8 because of compatibility with older devices. http://en.wikipedia.org/wiki/Backward_compatibility

They develop for 2.3.3 to support older platforms as well.

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

This means it supports from 2.3.3 to 4.2.2

You can use new apis and support old ones. With that kind of setup you must be careful to use new apis only when running new platforms.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
} else {
    asyncTask.execute(params);
}

If you support only Galaxy S3 it is fine to start from API 16

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="17" />

API 2.3.3 is some sort of "standard" for developing to android because until today (Or until last time I checked), about 40% of the Android market still use version 2.3.3, and if you develop with this API as the minSdkVersion (2.3.3 is 10 btw) you hit about 96% of the market (Google says). These numbers are changing as i'm writing those lines when more and more people upgrade to Android 4 (ICS and up). I believe that if you app can handle

API does matter, but it has nothing to do with the screen size or resolution. It has to do with functionality can be used.

For example, if you target android 2.3, then your app would work on 2.3 and all future versions, however, if you are making use of the new API functions within 2.3, and you try to install your app on a 2.2 device, when that new 2.3 function is called, your app will crash with a NoClassDefFoundError meaning that the class/function you tried to call doesn't exist.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top