Android:无法使用视频调用图库
我正在尝试调用 android gallery 并加载其中的视频。此方法对于意图 android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI
工作正常,但它对我来说无法正常工作并返回以下异常。有人可以帮我吗?
08-09 17:12:26.992: ERROR/AndroidRuntime(878): java.lang.RuntimeException: Unable to start activity ComponentInfo{a.b/a.b.SDCardVideoActivity}: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.PICK dat=content://media/external/video/media cmp=com.google.android.music/com.android.music.VideoBrowserActivity } from ProcessRecord{4052da08 878:a.b/10053} (pid=878, uid=10053) requires null
08-09 17:12:26.992: ERROR/AndroidRuntime(878): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.PICK dat=content://media/external/video/media cmp=com.google.android.music/com.android.music.VideoBrowserActivity } from ProcessRecord{4052da08 878:a.b/10053} (pid=878, uid=10053) requires null
我的代码如下
public class SDCardVideoActivity extends Activity {
final int REQ_CODE_PICK_VIDEO = 1;
String outputfilepath;
SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.header);
Intent i = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, REQ_CODE_PICK_VIDEO);
}
}
I'm trying to invoke android gallery with videos loaded with it. This method working fine for the intent android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI
but it doesn't work properly for me and returned following exceptions. Can someone hlep me out please.
08-09 17:12:26.992: ERROR/AndroidRuntime(878): java.lang.RuntimeException: Unable to start activity ComponentInfo{a.b/a.b.SDCardVideoActivity}: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.PICK dat=content://media/external/video/media cmp=com.google.android.music/com.android.music.VideoBrowserActivity } from ProcessRecord{4052da08 878:a.b/10053} (pid=878, uid=10053) requires null
08-09 17:12:26.992: ERROR/AndroidRuntime(878): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.PICK dat=content://media/external/video/media cmp=com.google.android.music/com.android.music.VideoBrowserActivity } from ProcessRecord{4052da08 878:a.b/10053} (pid=878, uid=10053) requires null
My code goes as below
public class SDCardVideoActivity extends Activity {
final int REQ_CODE_PICK_VIDEO = 1;
String outputfilepath;
SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.header);
Intent i = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, REQ_CODE_PICK_VIDEO);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已使用以下代码从我的活动中调用图库应用程序。
编辑1
要调用图库浏览器,请使用以下代码
要调用视频播放器,请使用以下代码
Shash
I have used the below code to invoke Gallery Application from my activity.
EDIT 1
To invoke Gallery browser use the below code
To invoke Video Player use the below code
Shash