Example usage for android.content Intent putExtra

List of usage examples for android.content Intent putExtra

Introduction

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

Prototype

@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:Main.java

public static void jump(Context context, Class clazz, String key, String value) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);/*from w w  w  .j av  a  2s  .  co  m*/
    intent.putExtra(key, value);
    context.startActivity(intent);
}

From source file:com.applift.api.tester.activity.AbstractResponseActivity.java

protected static Intent fillIntent(Intent intent, JSONObject obj) {
    intent.putExtra(JSON, obj.toString());
    return intent;
}

From source file:Main.java

public static void sendSMS(Context cxt, String smsBody) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    intent.putExtra("sms_body", smsBody);
    cxt.startActivity(intent);//  www  .j  av a  2  s .  co  m
}

From source file:Main.java

public static void goPage(Context context, Class<?> gopage, String extraName, String extraValue) {
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivity(intent);//  w ww  .  ja  v  a 2 s.  c  o  m
}

From source file:Main.java

public static void goPage(Context context, Class<?> gopage, String extraName, int extraValue) {
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivity(intent);/*  w  w w  .  java  2 s  . c  o  m*/
}

From source file:Main.java

public static void goPage(Context context, Class<?> gopage, String extraName, Parcelable extraValue) {
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivity(intent);/*from   ww w  .  j a  v a2 s . co m*/
}

From source file:Main.java

public static void sendBroadcast(Context context, String action, String extra, int value) {
    Intent broadcast = new Intent();
    broadcast.setAction(action);//from w  ww .j a  va 2 s  .c om
    broadcast.putExtra(extra, value);
    context.sendBroadcast(broadcast);
}

From source file:Main.java

/**
 * Notifies UI to display a message.//from  ww  w.  j  a  v a  2s.c o  m
 * 
 * This method is defined in the common helper because it's used both by the
 * UI and the background service.
 * 
 * @param context
 *            application's context.
 * @param message
 *            message to be displayed.
 */
static public void displayMessage(Context context, String message) {
    Intent intent = new Intent("at.sprinternet.odm.DISPLAY_MESSAGE");
    intent.putExtra("message", message);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void sendSMS(String smsBody, Context context, String num)

{

    Uri smsToUri = Uri.parse("smsto:" + num);

    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);

    intent.putExtra("sms_body", smsBody);

    context.startActivity(intent);//from w w  w  .java2  s  . c  o m

}

From source file:Main.java

public static void setAlarm(Context context, Intent intent, int notificationId, Calendar calendar) {
    intent.putExtra("NOTIFICATION_ID", notificationId);
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, notificationId, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
                pendingIntent);//from w ww  .  ja  v  a2s  .  c om
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
    } else {
        alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
    }
}