How to implement share via option in android?

前端 未结 3 1125
情深已故
情深已故 2020-12-25 14:40

I want to implement something like this. \"share

It should not be hard coded. If user haven\'t installed

相关标签:
3条回答
  • 2020-12-25 15:31

    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/

    0 讨论(0)
  • 2020-12-25 15:32

    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"));  
    
    0 讨论(0)
  • 2020-12-25 15:38
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    sharingIntent.putExtra(Intent.EXTRA_TEXT,"Extra text or Link that you want to add");
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Technical Speaks");
    startActivity(Intent.createChooser(sharingIntent, "Share via"));
    

    Get full Source code Click here

    0 讨论(0)
提交回复
热议问题