Java tutorial
//package com.java2s; //License from project: Apache License import android.annotation.SuppressLint; import android.app.Activity; import android.app.Fragment; import android.content.Intent; import android.net.Uri; import android.os.Bundle; public class Main { public static void sendSchemeForResult(Fragment activity, String url, int requestCode) { sendSchemeForResult((Fragment) activity, url, requestCode, (Bundle) null); } public static void sendSchemeForResult(Activity activity, String url, int requestCode) { sendSchemeForResult((Activity) activity, url, requestCode, (Bundle) null); } public static void sendSchemeForResult(Fragment activity, String url, int requestCode, int flag) { sendSchemeForResult((Fragment) activity, url, requestCode, (Bundle) null, flag); } public static void sendSchemeForResult(Activity activity, String url, int requestCode, int flag) { sendSchemeForResult((Activity) activity, url, requestCode, (Bundle) null, flag); } public static void sendSchemeForResult(Fragment activity, String url, int requestCode, Bundle bundle) { sendSchemeForResult((Fragment) activity, url, requestCode, bundle, 0); } public static void sendSchemeForResult(Activity activity, String url, int requestCode, Bundle bundle) { sendSchemeForResult((Activity) activity, url, requestCode, bundle, 0); } @SuppressLint("NewApi") public static void sendSchemeForResult(Fragment activity, String url, int requestCode, Bundle bundle, int flag) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url)); if (bundle != null) { intent.putExtras(bundle); } if (flag != 0) { intent.setFlags(flag); } activity.startActivityForResult(intent, requestCode); } public static void sendSchemeForResult(Activity activity, String url, int requestCode, Bundle bundle, int flag) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url)); if (bundle != null) { intent.putExtras(bundle); } if (flag != 0) { intent.setFlags(flag); } activity.startActivityForResult(intent, requestCode); } }