【发布时间】:2016-06-07 10:30:31
【问题描述】:
我正在尝试在
中打开我的应用settings-> applications-> user apps-> MyApp1
我正在使用这个 sn-p,它工作正常,但是,它在处理异常时失败。就像没有安装应用一样,在这种情况下它应该显示一个 toast 而不是关闭整个应用!
public void vpndragonsettings(View view) {
packageName = "org.wagtailvpn.android";
try {
// Open the specific App Info page:
Intent intent = new Intent(
android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + packageName));
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast toast = Toast.makeText(this, "app isn't installed!",
Toast.LENGTH_SHORT);
toast.show();
}
}
【问题讨论】: