Android意图使用视频播放器在res/raw文件中播放视频
我是Android新手,在使用stack Android视频播放器播放视频时遇到问题。我到处寻找答案,但没有找到 我的代码是:Android意图使用视频播放器在res/raw文件中播放视频,android,video,Android,Video,我是Android新手,在使用stack Android视频播放器播放视频时遇到问题。我到处寻找答案,但没有找到 我的代码是: Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.lp); Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.setPackage(getPackageName()); inten
Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.lp);
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setPackage(getPackageName());
intent.setDataAndType(uri, "video/*");
startActivity(intent);
它不工作,应用程序崩溃。怎么了?这取决于智能手机的型号吗?我的智能手机型号是THL 5000,安卓4.4.2
谢谢 尝试这样初始化。这对我有用
Uri.parse("android.resource://" + getPackageName() + "/raw/file_name");
尝试这样初始化。这对我有用
Uri.parse("android.resource://" + getPackageName() + "/raw/file_name");
不幸的是,其他应用程序(Android Intent)无法访问您的资源
它向我显示ActivityNotFoundException:'未找到处理Intent{act=android.Intent.action.VIEW dat=android的活动。resource://example.qqq.com.dcp/raw/lp.mp4 typ=video/*pkg=example.qqq.com.dcp}'if(getContext().getPackageManager().resolveActivity(intent,PackageManager.MATCH_DEFAULT_仅限)!=null){它向我显示ActivityNotFoundException:'未找到处理Intent{act=android.Intent.action.VIEW dat=android的活动。resource://example.qqq.com.dcp/raw/lp.mp4 typ=video/*pkg=example.qqq.com.dcp}'if(getContext().getPackageManager().resolveActivity(intent,PackageManager.MATCH_DEFAULT_仅限)!=null){