# Android functioins : fromSdk{}other{}, toSdk{}other{}, afterSdk{}other{}, untilSdk{}other{}

**URL:** <https://discuss.kotlinlang.org/t/android-functioins-fromsdk-other-tosdk-other-aftersdk-other-untilsdk-other/11861>\
**Category:** Android\
**Created:** [March 7, 2019, 5:29am UTC](https://discuss.kotlinlang.org/t/android-functioins-fromsdk-other-tosdk-other-aftersdk-other-untilsdk-other/11861 "2019-03-07T05:29:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorss](https://avatars.discourse-cdn.com/v4/letter/l/3ec8ea/32.png) [@lorss](https://discuss.kotlinlang.org/u/lorss)\
**Post date:** [March 7, 2019, 5:29am UTC](https://discuss.kotlinlang.org/t/android-functioins-fromsdk-other-tosdk-other-aftersdk-other-untilsdk-other/11861/1 "2019-03-07T05:29:43Z")

</div>

[Source Code \<\< \<\< \<\< click here](https://github.com/yaqingzhang/kotlin-ext-android/blob/ae8d16d4accd6a8d87920fd702cdbff79d41fddf/kotlin_ext/src/main/java/com/runningmessage/kotlin/common/AndroidExt.kt)

e.g.

```auto
fromSdk(16){   
    view.background = null
} other {
    view.setBackgroundDrawable(null)
}

```

functioins :

```auto
 fromSdk {...} other {...}
 toSdk {...} other {...}
 afterSdk {...} other {...}
 untilSdk {...} other {...}

```

---

<div class="post-metadata">

**Author:** ![Beholder](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/beholder/32/2078_2.png) [@Beholder](https://discuss.kotlinlang.org/u/Beholder)\
**Post date:** [March 7, 2019, 11:20am UTC](https://discuss.kotlinlang.org/t/android-functioins-fromsdk-other-tosdk-other-aftersdk-other-untilsdk-other/11861/2 "2019-03-07T11:20:28Z")

</div>

Wouldn’t that be shorter?

```auto
    when {
        sdkLevel(16) -> view.background = null
        else -> view.setBackroundDrawable(null)
    }

```
