koifish082
10/11/2018 - 10:16 AM

Navigator

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);
    }
}