mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-04 14:17:30 +00:00
Handle ActivityNotFoundException while opening URL. Fixes https://github.com/austinhuang0131/barinsta/issues/351
This commit is contained in:
parent
3dfbf23cc0
commit
6b370ca251
@ -1,6 +1,7 @@
|
|||||||
package awais.instagrabber.utils;
|
package awais.instagrabber.utils;
|
||||||
|
|
||||||
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.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@ -182,7 +183,13 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
final Intent i = new Intent(Intent.ACTION_VIEW);
|
final Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
i.setData(Uri.parse(url));
|
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) {
|
public static void openEmailAddress(final Context context, final String emailAddress) {
|
||||||
|
Loading…
Reference in New Issue
Block a user