Reputation: 1638
I have read this article: Sending the User to Another App
If user click on a button, and they should be sent to a video player to watch the video, could anyone please tell me what I should put in the Intent's constructor? I have the path of an mp4 file as String
.
Upvotes: 0
Views: 67
Reputation: 6728
try following code
File file=new File(filepath);
Uri uriToFile=Uri.fromFile(file);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToFile);
shareIntent.setType("*/mp4");
startActivity(Intent.createChooser(shareIntent,"Send to"));
Upvotes: 2