I’m using the following code in an application of mine, and it’s always used to work with the default video player in Android 3.0 – 3.2. I haven’t updated the OS, but for some reason the default video player no longer shows up as an option when you select which application you want to open the video file with.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(filePath), "video/*");
startActivity(intent);
I may have changed the setDataAndType() method from Uri.fromFile(file) to Uri.parse(filepath), but would that be enough to make such a difference?
Any ideas?
I’ve finally found a solution to my question, and I think it’s rather weird. The following bit of code does not work:
… but this does:
It would appear that
Uri.fromFile()is required if you want the default OS video player to pop up in the list of applications capable of opening the video file. I have no idea why that’s the case though.