简体   繁体   中英

How to get all share apps (installed on the device) in a list?

i want to get share list and to to be able to share text, i used this question but there were weaknesses such as the Gmail with empty subject filed and the facebook was shown in list but doesn't work with the share.

i searched for long time but didn't find the complete answer.

please help.

NOTE: i just want to share text with links nothing more.

thanx

This is generally handled by using intent.setData(uri) with a URI that has the schema set to a relevant value. For instance if you wanted to share via email apps you might use the scheme 'mailto'

Edit: Facebook specific example - The following will work to share with facebook - the bit to note for facebook is it seems like your EXTRA_TEXT needs to be JUST a link or CONTAIN at least one link otherwise Facebook doesn't like it...

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "This is text from http://www.myapp.com");
startActivity(Intent.createChooser(intent, "Share"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM