therajeshreddy
therajeshreddy

Reputation: 21

Unable to play video using Intent Android

I have been trying to play video file from SD card but it gives me below error.

NOTE: I'm able to open the video when MX player is installed on my device. When i un install it gives me error again. Any thoughts on what i'm doing wrong..

09-06 19:39:07.561: E/AndroidRuntime(24627): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/storage/sdcard0/Movies/MyCameraApp/VID_20140906_193112.mp4 typ=video/* }

            Intent tostart = new Intent(Intent.ACTION_VIEW);
            String movieurl;
            movieurl=filelist[position].getPath();
            tostart.setDataAndType(Uri.parse(movieurl), "video/*");
            Log.d("Raj Path :", movieurl);
            Log.d("Raj Path :", Uri.parse(movieurl).toString());
            startActivity(tostart);

Upvotes: 0

Views: 1189

Answers (1)

therajeshreddy
therajeshreddy

Reputation: 21

Used "Uri.fromFile(file)" to fix issue.

tostart.setDataAndType(Uri.fromFile(filelist[position]), "video/*");

Upvotes: 2

Related Questions