Share Text Intent Intent = new Intent (intent.action_send); Intent.putextra (Intent.extra_text, "the text to be shared. Intent.settype ("Text/plain"); StartActivity (Intent.createchooser (Intent, "sharing"));
Share picture uri uri = uri.fromfile (New File ("/storage/emulated/0/dcim/camera/img.jpg")); Intent Intent = new Intent ( Intent.action_send); Intent.putextra (Intent.extra_stream, URI); Intent.settype ("Image/jpeg"); StartActivity ( Intent.createchooser (Intent, "share"));
Share a series of pictures arraylist<uri> URIs = new arraylist<> (); Uris.add (Uri.fromfile ("/storage/emulated/0/") Dcim/camera/img.jpg ")); Uris.add (Uri.fromfile (New File ("/storage/emulated/0/dcim/camera/aaa.jpeg ")); Intent Intent = new Intent (intent.action_send_multiple); Intent.putparcelablearraylistextra (Intent.extra_stream, URIs); Intent.settype ("image/*"); StartActivity (Intent.createchooser (Intent, "sharing"));
The principle should be this: for example, registered an ACTION for intent.action_send activity, share only call the activity, the data passed, these are in the mobile phone, do not need to network, by the realization of sharing, So just the need for Internet permissions.
Call system sharing function