Share text content
New Intent (); sendintent.setaction (intent.action_send); Sendintent.putextra (Intent.extra_text,"This is my TEXT To send. " ); Sendintent.settype ("Text/plain"); StartActivity (sendintent) ;
If Intent.createchooser () is called for intent, there are several benefits:
1. Even if the user has previously set the default action for this intent, the selection screen will be displayed.
2. If there is no matching program, Android displays the system information.
3. We can specify the title of the selection interface.
Just modify the last line of code to StartActivity (Intent.createchooser (Sendintent, Getresources (). GetText (r.string.send_to));
Sharing binary Content
New Intent (); shareintent.setaction (intent.action_send); Shareintent.putextra (Intent.extra_stream, uriToImage); Shareintent.settype ("Image/jpeg"); StartActivity (Intent.createchooser (shareintent, getresources (). GetText (r.string.send_to));
Send multiple pieces of content
New arraylist<uri>// Add your image URIsherenew Intent (); Shareintent.setaction (intent.action_send_multiple); Shareintent.putparcelablearraylistextra (Intent.EXTRA_STREAM , Imageuris); Shareintent.settype ("image/*""Share images to.."));
If it's a different picture format, you should use image/* to match activity that can receive any type of image.
If you need to share many different types of data, you can use */* to represent MIME
Android Development share simple data (top)