Skip to content

Instantly share code, notes, and snippets.

@Sammekl
Sammekl / SpinnerExt.kt
Created January 29, 2019 14:44
Spinner extensions Android
fun AppCompatSpinner.isDefaultSelected() = this.selectedItemPosition == 0
fun AppCompatSpinner.setSelectedValue(value: String?) {
setSelection(when (value) {
null -> 0
else -> adapter.getPositionOf(value, true)
})
}
fun SpinnerAdapter.getPositionOf(value: String, ignoreCase: Boolean = true): Int {
A1-811 (mango)
A1-830 (ducati)
CHC-U23 (hwCHC-H)
Desire 610 (htc_a3qhdul)
Galaxy Core2 (kanas3gnfc)
Galaxy J5(2016) (j5xnlte)
Galaxy S3 Neo (s3ve3g)  
--------- beginning of crash
06-07 01:55:24.956 7165-7107/? A/google-breakpad: -----BEGIN BREAKPAD MICRODUMP-----
V AndroidWebView:67.0.3396.68
O A arm 08 armv8l OnePlus/OnePlus6/OnePlus6:8.1.0/OPM1.171019.011/05172042:user/release-keys
P browser
R 0000000B SIGSEGV B6503A04
G
06-07 01:55:24.959 7165-7107/? A/google-breakpad: H 05385000 FFBB9000 007F 35296000 6A691000 0C:74 0D:01 0E:01 0F:02 10:01 12:02 1B:02 1C:01 1D:01
06-07 01:55:24.960 7165-7107/? A/google-breakpad: S 0 B27C6C50 B27C6000 00003000