How to implement share via option in android?

柔情痞子 提交于 2019-12-02 19:24:34

You can do the same by using:

Intent i=new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject test");
i.putExtra(android.content.Intent.EXTRA_TEXT, "extra text that you want to put");
startActivity(Intent.createChooser(i,"Share via"));

Detailed example is here for your reference: http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/

Gaurav Lambole

For Sharing the Content Via:

Intent shareIntent =  new Intent(android.content.Intent.ACTION_SEND); 

//set type  

shareIntent.setType("text/plain");  

//add what a subject you want

shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"add what a subject you want");  

 String shareMessage="message body"; 

//message  

shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,shareMessage); 

//start sharing via 

startActivity(Intent.createChooser(shareIntent,"Sharing via"));  
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!