Android Catch error msg return from intent actionview抱歉,无法播放此视频
下面是我的代码Android Catch error msg return from intent actionview抱歉,无法播放此视频,android,video,Android,Video,下面是我的代码 Intent intent = new Intent(Intent.ACTION_VIEW); File file = new File(SDCardRoot,filename); intent.setDataAndType(path, "video/quicktime"); try { startActivity(intent); } catch (ActivityNotFoundException ex) { } 您知道如何在不
Intent intent = new Intent(Intent.ACTION_VIEW);
File file = new File(SDCardRoot,filename);
intent.setDataAndType(path, "video/quicktime");
try {
startActivity(intent);
}
catch (ActivityNotFoundException ex) {
}
您知道如何在不显示的情况下捕获msg吗?对不起,当我尝试播放mov文件格式并替换为我自己的句子以打开错误时,无法播放此视频。您当前捕获的是“ActivityNotFoundException”,因此无法捕获其他异常。您必须将ActivityNotFoundException更改为更通用的内容(例如“Exception”),或者添加另一个catch子句 解决方案1:
try {
startActivity(intent);
}
catch (Exception ex) {
}
解决方案2:
try {
startActivity(intent);
}
catch (ActivityNotFoundException ex) {
}
catch (...<insert your particular exception type here>...) {
}
试试{
星触觉(意向);
}
捕获(ActivityNotFoundException ex){
}
捕获(……){
}
您到底遇到了什么问题?你已经试过了。我假设quesion中的错误确实是由startActivity引发的,所以只需在catch部分显示一个toast或对话框。当视频显示error msg但catch无法捕获它时。这就是我面临的问题。