0

Below this code i try to share text with video but it only share video,text not share with video.

please help if any one have solution of my issue.

String path="android.resource://" + "com.avani.videoviewdemo" + "/" + R.raw.ae_kaash_kahi;
 //Intent a = getIntent(); 
file=new File(path); 
str=arrayList.get(position).getVideoName(); 
Log.e("video_name", ""+arrayList.get(position).getVideoName()); Log.e("video_name",""+ str); 
id = context.getResources().getIdentifier(str, "raw", context.getPackageName()); Uri uri = Uri.parse("android.resource://" + context.getPackageName() + "/" + id);
 DownloadFile(); 
Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
Uri screenshotUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file); sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); sharingIntent.putExtra(Intent.EXTRA_TEXT, "From FullScreenVideoStatus"); sharingIntent.setType("video/*"); context.startActivity(Intent.createChooser(sharingIntent, "Share video using"));

Avani
  • 29
  • 1
  • 3
  • Have a look here https://stackoverflow.com/questions/20333186/how-to-share-image-text-together-using-action-send-in-android – AskNilesh Aug 08 '18 at 04:12
  • The only i can think of is `Intent.EXTRA_TEXT` and `Intent.EXTRA_STREAM` . For some 3rd party app it will work for some it will not . – ADM Aug 08 '18 at 04:15
  • https://stackoverflow.com/questions/18603524/share-intent-does-not-work-for-uploading-video-to-youtube/63600386#63600386 – Abhishek Kumar Aug 26 '20 at 15:03

3 Answers3

0

For set caption in video/image in share intent, just set text in:

sharingIntent.putExtra(Intent.EXTRA_TITLE, "Your text caption");
Mohammad
  • 16
  • 6
0
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("video/mp4"); //If it is a 3gp video use ("video/3gp")
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/raw/ae_kaash_kahi";
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Video Title");
startActivity(Intent.createChooser(sharingIntent, "Share Video!"));
-1
        intent = new Intent(Intent.ACTION_SEND);
        intent.putExtra(Intent.EXTRA_TEXT, "TEMPORARY"); // for text share
        intent.putExtra(Intent.EXTRA_STREAM, uri); // for media share
        intent.setType("image/*"); // this line is use to filter which app support specified media formate to share
        startActivity(intent);

you can use video/* for video file here i have used image/* for image share

Vinesh Chauhan
  • 1,288
  • 11
  • 27