Created
August 23, 2022 10:38
-
-
Save mo7amd89/4af6e658e588c037cbc2bc63a8051a60 to your computer and use it in GitHub Desktop.
inline function koltin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.widget.Toast | |
import androidx.fragment.app.Fragment | |
inline fun Context.toast(message:()->String){ | |
Toast.makeText(this, message() , Toast.LENGTH_LONG).show() | |
} | |
inline fun Fragment.toast(message:()->String){ | |
Toast.makeText(this.context, message() , Toast.LENGTH_LONG).show() | |
} | |
// =>>> | |
/* | |
toast { | |
"Hello World" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment