mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-21 05:18:10 -05:00
29 lines
797 B
Java
29 lines
797 B
Java
package protect.card_locker;
|
|
|
|
import android.app.Activity;
|
|
import android.content.ActivityNotFoundException;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
import android.widget.Toast;
|
|
|
|
public class OpenWebLinkHandler {
|
|
|
|
private static final String TAG = "Catima";
|
|
|
|
public void openBrowser(Activity 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);
|
|
}
|
|
}
|
|
}
|