Fix ActivityNotFoundException

This commit is contained in:
ZaneYork 2020-03-14 11:19:44 +08:00
parent 3611bfe27e
commit d4e8ff6dd5
2 changed files with 11 additions and 6 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "com.zane.smapiinstaller"
minSdkVersion 19
targetSdkVersion 28
versionCode 8
versionName "1.2.0"
versionCode 10
versionName "1.2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

View File

@ -1,6 +1,7 @@
package com.zane.smapiinstaller.logic;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@ -107,10 +108,14 @@ public class CommonLogic {
}
public static void openUrl(Context context, String url) {
Intent intent = new Intent();
intent.setData(Uri.parse(url));
intent.setAction(Intent.ACTION_VIEW);
context.startActivity(intent);
try {
Intent intent = new Intent();
intent.setData(Uri.parse(url));
intent.setAction(Intent.ACTION_VIEW);
context.startActivity(intent);
}
catch (ActivityNotFoundException ignored){
}
}
public static boolean copyToClipboard(Context context, String copyStr) {