Fix ActivityNotFoundException
This commit is contained in:
parent
3611bfe27e
commit
d4e8ff6dd5
|
@ -9,8 +9,8 @@ android {
|
||||||
applicationId "com.zane.smapiinstaller"
|
applicationId "com.zane.smapiinstaller"
|
||||||
minSdkVersion 19
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 8
|
versionCode 10
|
||||||
versionName "1.2.0"
|
versionName "1.2.2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.zane.smapiinstaller.logic;
|
package com.zane.smapiinstaller.logic;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -107,11 +108,15 @@ public class CommonLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openUrl(Context context, String url) {
|
public static void openUrl(Context context, String url) {
|
||||||
|
try {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.setData(Uri.parse(url));
|
intent.setData(Uri.parse(url));
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
catch (ActivityNotFoundException ignored){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean copyToClipboard(Context context, String copyStr) {
|
public static boolean copyToClipboard(Context context, String copyStr) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue