Example usage for android.content Intent putExtras

List of usage examples for android.content Intent putExtras

Introduction

In this page you can find the example usage for android.content Intent putExtras.

Prototype

public @NonNull Intent putExtras(@NonNull Bundle extras) 

Source Link

Document

Add a set of extended data to the intent.

Usage

From source file:com.finchuk.clock2.util.LocalBroadcastHelper.java

/** Sends a local broadcast using an intent with the action and the extras specified */
public static void sendBroadcast(Context context, String action, Bundle extras) {
    Intent intent = new Intent(action);
    if (extras != null) {
        intent.putExtras(extras);
    }/*w w w  .  j ava 2  s.  co  m*/
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}

From source file:Main.java

public static void start(Context context, Class<? extends Activity> clazz, String arg1) {
    Intent intent = new Intent(context, clazz);
    Bundle bundle = new Bundle();
    bundle.putString(ARG_1, arg1);/*from w w  w  .  j  a v  a2 s.  c  o  m*/
    intent.putExtras(bundle);
    context.startActivity(intent);
}

From source file:Main.java

public static void sendBroadcast(Context context, String filter, Bundle bundle) {
    if (context == null) {
        return;//from ww w  . j a va  2s .  co  m
    }
    Intent intent = new Intent();
    intent.setAction(filter);
    intent.putExtras(bundle);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static Intent gotoIntent_WithString(Context context, Class c, String accessName, String value) {
    Bundle bundle = new Bundle();
    bundle.putString(accessName, value);
    Intent intent = new Intent();
    intent.setClass(context, c);/*www .j  av a 2 s .c o m*/
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);
    return intent;
}

From source file:Main.java

public static void openActivity(Context context, Class<?> activity, Bundle b, int flags) {
    Intent intent = new Intent(context, activity);
    intent.addFlags(flags);//from w  ww  .  j av  a2  s .com
    if (b != null)
        intent.putExtras(b);
    context.startActivity(intent);
}

From source file:Main.java

public static void forward(Context context, Class<?> dest, Bundle extras) {
    Intent intent = new Intent(context, dest);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (null != extras) {
        intent.putExtras(extras);
    }//  ww  w . java 2 s .c  om
    context.startActivity(intent);
}

From source file:Main.java

public static void openActivity(Context context, Class<?> clazz, Bundle... bundles) {
    Intent intent = new Intent(context, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (bundles != null && bundles.length > 0) {
        intent.putExtras(bundles[0]);
    }//  ww  w. jav  a 2  s.c o  m
    context.startActivity(intent);
}

From source file:Main.java

public static void ActivitySkipWithObject(Context context, Class<?> toClass, String key, Serializable obj) {
    Intent intent = new Intent();
    intent.setClass(context, toClass);//from   w  ww .ja  v  a 2  s. co m
    Bundle bundle = new Bundle();
    bundle.putSerializable(key, obj);
    intent.putExtras(bundle);
    //        int id =((IdObj)bundle.getSerializable("  ")).getId();
    context.startActivity(intent);
}

From source file:Main.java

public static void startActivityWithObjectForResult(Context context, Class<?> toClass, String key,
        Serializable obj, int requestCode) {
    Intent intent = new Intent();
    intent.setClass(context, toClass);//from   www  .ja v a  2  s. c  o  m
    Bundle bundle = new Bundle();
    bundle.putSerializable(key, obj);
    intent.putExtras(bundle);
    //        int id =((IdObj)bundle.getSerializable("  ")).getId();
    ((Activity) context).startActivityForResult(intent, requestCode);
}

From source file:Main.java

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);
    }//from   w  w  w  . j av a  2s.  c om

    if (flag != 0) {
        intent.setFlags(flag);
    }

    activity.startActivityForResult(intent, requestCode);
}