-2
我想用Intent开始一个活动。以下是使用意图的代码:意图 - 如何检查意向是否已启动?
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("rtmp:example"))
startActivity(i);
我想在此意图找不到第三方应用程序时显示对话框。
我该怎么做?
下面是我的尝试和catch块代码:
try {
startActivity(i2);
} catch() {
AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext());
b.setMessage("You need MX player or VLC player to play the video.");
b.create().show();
}
你测试过这种情况吗?我认为如果Android找不到活动,它会抛出异常。 – trungdinhtrong 2015-01-21 03:16:28
是的,它强制关闭 – Developer110 2015-01-21 03:17:09
我不想那样做 – Developer110 2015-01-21 03:17:24