Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Extensions function in kotlin provide the ability to extend the class with new functionality without extends the class. Extensions function do not modify class they extend the class and insert new functionality in the class.
Let’s begin with very basic we know that to show a simple Toast in an Activity we have to write boilerplate code we have to pass context, message and the duration in makeText() method. Then the question arises how extension function can make our life easy so let’s start with Toast now I going to show you how we can extend the Activity class and add new functionality to just show toast anywhere in activity all we have to do just call showToast() method and pass the message.
In the above example, we have seen how extension function we can write to just show a Toast and call it in any activity in our application.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Webkul is a truly trusted and supported IT Company to develop business ideas for e-commerce. They provide professional support after deploying the solution to production and be responsible to act for fixing the reported issues or system errors. We highly encourage to deal with Webkul for business development.
Hussein Zawia
Co-founder, 24Dokan
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.