Check out this android.os.Build.VERSION.
if(Build.VERSION.SDK_INT >= 4.0){
//this code will be executed on devices running on DONUT (NOT ICS) or later
} else if(Build.VERSION.SDK_INT < 4.0){
}
Question
Im developing an android-app which handles a ListView with several TextViews within it as childs.
The problem (already solved) came when I tried to get child from the parent view by using getChildAt(pos) method.
I have tested my app in two devices with different android versions installed, and I got the following conclusions:
In android 2.2.1 the parent view refers their childs by using the following position-indexation:
Parent.
In android 4.0.3 the parent view refers their childs by using the following position-indexation:
Parent.
So, I would like to know from which version it changed the child indexation protocol in order to operate in one way or antoher depending on the android version installed in the target device.
What I want to do is somthing like this:
if androidVersion >= X then
___Use new chlid-indexation protocol
else
___Use old child-indexation protocol
Thanks.
Solution
Check out this android.os.Build.VERSION.
if(Build.VERSION.SDK_INT >= 4.0){
//this code will be executed on devices running on DONUT (NOT ICS) or later
} else if(Build.VERSION.SDK_INT < 4.0){
}