Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

class MyInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
}
}
fun encodeImage(bm: Bitmap): String? {
val baos = ByteArrayOutputStream()
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos)
val b = baos.toByteArray()
return Base64.encodeToString(b, Base64.DEFAULT)
}
fun decodeImage(bm: String, imageView: ImageView,resources: Resources) {
val imageBytes = Base64.decode(bm, Base64.DEFAULT)
val decodedImage = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size)
fun printUserInfo(name: String, getSurName: (surName: String) -> String = { "" }, age: Int): Unit {
}
fun main() {
val higherOrderFunction = { surName: String -> "surName : $surName" }
val anonymousFunction = fun(surName: String): String { return "surName : $surName" }
printUserInfo("EMRE", higherOrderFunction, 20)
printUserInfo("EMRE", anonymousFunction, 20)
printUserInfo("EMRE", fun(surName: String): String {
return "surName : $surName"
}, 20)
val anonymousFunction = fun(surName: String): String { return "surName : $surName" }
val higherOrderFunction = { surName: String -> "surName : $surName" }
fun main() {
val test = Test()
test.main()
}
class Test {
fun main() {
3 topla 5
}
fun main() {
3 topla 5
}
infix fun Int.topla(sayi: Int) {
return println(this + sayi)// this =3 , sayi=5
}
fun main() {
3.topla(5)
}
fun Int.topla(sayi: Int) {
return println(this + sayi)// this =3 , sayi=5
}
fun main() {
val test = Test()
test ekranaYaz "selam"
}
class Test {
infix fun ekranaYaz(metin: String) {
return print(metin)
}
}