Uri.parse(uriString)
val uri = Uri.parse(myUriString)
val uri = myUriString.toUri()
sharedPreferences.edit() .putBoolean(key, value) .apply()
sharedPreferences.edit { putBoolean(key, value) }
val pathDifference = Path(myPath1).apply { op(myPath2, Path.Op.DIFFERENCE) } val myPaint = Paint() canvas.apply { val checkpoint = save() translate(0F, 100F) drawPath(pathDifference, myPaint) restoreToCount(checkpoint) }
val pathDifference = myPath1 - myPath2 canvas.withTranslation(y = 100F) { drawPath(pathDifference, myPaint) }
view.viewTreeObserver.addOnPreDrawListener( object : ViewTreeObserver.OnPreDrawListener { override fun onPreDraw(): Boolean { viewTreeObserver.removeOnPreDrawListener(this) actionToBeTriggered() return true } })
view.doOnPreDraw { actionToBeTriggered() }
build.gradle
repositories { google() } dependencies { // Android KTX for framework API implementation 'androidx.core:core-ktx:0.1' ... }
androidx
android.*
androidx.*