mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-08 19:46:10 +01:00
Changed: Only show system chooser if ActivityNotFoundException is thrown when opening url
This commit is contained in:
parent
dd952a90ad
commit
e36c5294db
1 changed files with 4 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package com.termux.shared.interact;
|
|||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
|
@ -97,9 +98,11 @@ public class ShareUtils {
|
|||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// If no activity found to handle intent, show system chooser
|
||||
openSystemAppChooser(context, intent, context.getString(R.string.title_open_url_with));
|
||||
} catch (Exception e) {
|
||||
Logger.logStackTraceWithMessage(LOG_TAG, "Failed to open url \"" + url + "\"", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue