1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00

Handle ActivityNotFoundException while opening URL. Fixes https://github.com/austinhuang0131/barinsta/issues/351

This commit is contained in:
Ammar Githam 2020-11-30 19:01:03 +09:00
parent 3dfbf23cc0
commit 6b370ca251

View File

@ -1,6 +1,7 @@
package awais.instagrabber.utils;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ContentResolver;
@ -182,7 +183,13 @@ public final class Utils {
}
final Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
context.startActivity(i);
try {
context.startActivity(i);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "openURL: No activity found to handle URL view", e);
} catch (Exception e) {
Log.e(TAG, "openURL", e);
}
}
public static void openEmailAddress(final Context context, final String emailAddress) {