mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-18 03:48:01 -05:00
30 lines
827 B
Java
30 lines
827 B
Java
package protect.card_locker;
|
|
|
|
import android.content.ActivityNotFoundException;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
import android.widget.Toast;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
public class OpenWebLinkHandler {
|
|
|
|
private static final String TAG = "Catima";
|
|
|
|
public void openBrowser(AppCompatActivity activity, String url) {
|
|
if (url == null) {
|
|
return;
|
|
}
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
intent.setData(Uri.parse(url));
|
|
try {
|
|
activity.startActivity(intent);
|
|
} catch (ActivityNotFoundException e) {
|
|
Toast.makeText(activity, R.string.failedToOpenUrl, Toast.LENGTH_LONG).show();
|
|
Log.e(TAG, "No activity found to handle intent", e);
|
|
}
|
|
}
|
|
}
|