Reputation: 96
Hi All I want to play video in android from raw folder in native player .I able to play video from sd card and server url. But if my mp4 is in raw folder its fire exception. Can somebody help me.
My code is here.
Uri uri = Uri.parse("android.resource://" + getPackageName() + R.raw.sun);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);intent.setDataAndType(uri, "video/*");
startActivity(intent);
its working if i play using Video View but i don't want play in Video View.
Upvotes: 0
Views: 1887
Reputation: 677
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/"+R.raw.sun);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);intent.setDataAndType(uri, "video/*");
startActivity(intent);
what you missed is simply the "/" Hope this helps :)
Upvotes: 2