Skip to content

Instantly share code, notes, and snippets.

@koifish082
Last active October 17, 2018 08:42
Show Gist options
  • Save koifish082/48a3fa7b7450f4b7afa64e6c4f8d81b0 to your computer and use it in GitHub Desktop.
Save koifish082/48a3fa7b7450f4b7afa64e6c4f8d81b0 to your computer and use it in GitHub Desktop.
package jp.co.sample.presentation.navigation;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.app.FragmentManager;
import jp.co.sample.R;
import jp.co.sample.utils.DialogUtils;
import timber.log.Timber;
public class Navigator {
public static void navigateToBrowserIntent(Context context, FragmentManager fragmentManager, String url) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (i.resolveActivity(context.getPackageManager()) == null) {
DialogUtils.showOkButtonDialog(fragmentManager, context.getString(R.string.error_message_browser_is_not_installed));
return;
}
context.startActivity(i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment