How to Share Text with Intent? in Kotlin on Android Studio

Share Text Intent in Android Kotlin

Hello there i'm Hemanth Kumar, welcome you to Lonely Developers. In this blog i will help with knowledge to beginners and programmers. that's all for intro lets get into the topic

Sharing Text Intent in Kotlin on Android Studio

It is simple with just 3 lines of code

first we call intent 
val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.putExtra(Intent.EXTRA_TEXT,"Your Message")
shareIntent.type = "text/plain"
startActivity(Intent.createChooser(shareIntent," Share this to :"))

that's it guys it is simple only these line of code will solve your problem

Note: There some mistakes like putExtra or may putExtras because it is on blog, only minor errors like syntax problems you will get solve on andriod Studio.

Thanks you guys for reading this blog post keep checking more posts in this website, bye.

Post a Comment

0 Comments