List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:Main.java
public static void sendBroadcast(Context context, String filter, Bundle bundle) { if (context == null) { return;//from w w w . ja va 2s . co m } Intent intent = new Intent(); intent.setAction(filter); intent.putExtras(bundle); if (mLocalBroadcastManager == null) { getLocalBroadcastManager(context.getApplicationContext()); } mLocalBroadcastManager.sendBroadcast(intent); }
From source file:Main.java
@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); }//w w w. ja v a 2 s. com if (flag != 0) { intent.setFlags(flag); } activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void navigateUp(Activity activity, Bundle extras) { Intent upIntent = NavUtils.getParentActivityIntent(activity); if (upIntent != null) { if (extras != null) { upIntent.putExtras(extras); }/* w w w. j av a 2s.com*/ if (NavUtils.shouldUpRecreateTask(activity, upIntent)) { // This activity is NOT part of this app's task, so create a new task // when navigating up, with a synthesized back stack. TaskStackBuilder.create(activity) // Add all of this activity's parents to the back stack. .addNextIntentWithParentStack(upIntent) // Navigate up to the closest parent. .startActivities(); } else { // This activity is part of this app's task, so simply // navigate up to the logical parent activity. // According to http://stackoverflow.com/a/14792752/2420519 //NavUtils.navigateUpTo(activity, upIntent); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); activity.startActivity(upIntent); } } activity.finish(); }
From source file:Main.java
public static void sendScheme(Context context, String url, Bundle bundle, boolean clearTop, int flag) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url)); if (bundle != null) { intent.putExtras(bundle); }/*from w w w . ja va 2 s . co m*/ if (clearTop) { intent.addFlags(67108864); } if (flag != 0) { intent.setFlags(flag); } context.startActivity(intent); }
From source file:Main.java
@SuppressLint("NewApi") public static void sendScheme(Fragment context, String url, Bundle bundle, boolean clearTop, int flag) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url)); if (bundle != null) { intent.putExtras(bundle); }/*from ww w.j a va2 s .c om*/ if (clearTop) { intent.addFlags(67108864); } if (flag != 0) { intent.setFlags(flag); } context.startActivity(intent); }
From source file:Main.java
public static void openActivity(Activity activity, String pAction, Bundle pBundle, int requestCode) { if (null == activity) return;/*from w ww . j a v a 2s. c om*/ Intent intent = new Intent(pAction); if (pBundle != null) { intent.putExtras(pBundle); } if (requestCode < 0) { activity.startActivity(intent); } else { activity.startActivityForResult(intent, requestCode); } }
From source file:com.app.common.util.IntentUtils.java
public static void startActivity(Activity activity, Class<?> cls, Bundle bundle) { Intent intent = new Intent(); intent.setClass(activity, cls);/* www .j ava2s. co m*/ if (null != bundle) { intent.putExtras(bundle); } activity.startActivity(intent); }
From source file:com.app.common.util.IntentUtils.java
public static void startActivityForResult(Activity activity, Class<?> cls, Bundle bundle, int requestCode) { Intent intent = new Intent(); intent.setClass(activity, cls);/*from w w w .jav a2 s . c o m*/ if (null != bundle) { intent.putExtras(bundle); } activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void start(Activity activity, Fragment fragment, Class<?> cls, Bundle extras, int req_code, int enterAnim, int exitAnim) { if (null != activity) { Intent intent = new Intent(activity, cls); if (null != extras) { intent.putExtras(extras); }/* ww w .ja v a 2s .c om*/ if (REQUEST_CODE_INVALID == req_code) { activity.startActivity(intent); } else { activity.startActivityForResult(intent, req_code); } if (0 != enterAnim || 0 != exitAnim) { activity.overridePendingTransition(enterAnim, exitAnim); } } else if (null != fragment) { activity = fragment.getActivity(); if (null != activity) { Intent intent = new Intent(activity, cls); if (null != extras) { intent.putExtras(extras); } if (REQUEST_CODE_INVALID == req_code) { fragment.startActivity(intent); } else { fragment.startActivityForResult(intent, req_code); } if (0 != enterAnim || 0 != exitAnim) { activity.overridePendingTransition(enterAnim, exitAnim); } } } }
From source file:com.facebook.internal.FacebookWebFallbackDialog.java
public static boolean presentWebFallback(final Context context, String dialogUrl, String applicationId, final FacebookDialog.PendingCall appCall, final FacebookDialog.Callback callback) { if (Utility.isNullOrEmpty(dialogUrl)) { return false; }/*from w ww .j av a 2s .c o m*/ String redirectUrl = String.format("fb%s://bridge/", applicationId); // Show the webdialog. FacebookWebFallbackDialog fallbackWebDialog = new FacebookWebFallbackDialog(context, dialogUrl, redirectUrl); fallbackWebDialog.setOnCompleteListener(new WebDialog.OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { Intent dummyIntent = new Intent(); dummyIntent.putExtras(values == null ? new Bundle() : values); FacebookDialog.handleActivityResult(context, appCall, appCall.getRequestCode(), dummyIntent, callback); } }); fallbackWebDialog.show(); return true; }