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 sendMessage(Context context, String number, String message) {
    Uri uri = Uri.parse("smsto:" + number);
    Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
    sendIntent.putExtra("sms_body", message);
    context.startActivity(sendIntent);//from  w  w w.  j ava 2 s.  c  o m
}

From source file:Main.java

public static void gotoActivity(Context ctx, Class<?> c, String s, boolean b, int flag) {
    Intent intent = new Intent(ctx, c);
    intent.putExtra(s, b);
    intent.setFlags(flag);/*from w ww.  ja  v  a2s  .  c om*/
    ctx.startActivity(intent);
    ((Activity) ctx).finish();
}

From source file:Main.java

public static Intent buildCaptureIntent(Uri uri) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    return intent;
}

From source file:Main.java

public static void sendSMS(Context context, String tel, String message) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
    sendIntent.putExtra("sms_body", message);
    context.startActivity(sendIntent);// ww  w . ja  va 2  s  .c o m
}

From source file:Main.java

public static void setAlarm(Context context) {
    Intent alarmas = new Intent(AlarmClock.ACTION_SET_ALARM);
    alarmas.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm");
    alarmas.putExtra(AlarmClock.EXTRA_HOUR, 10);
    alarmas.putExtra(AlarmClock.EXTRA_MINUTES, 30);
    context.startActivity(alarmas);/* w w w.  j av  a  2s.  c  o m*/
}

From source file:Main.java

public static void sendSMS(Context context, String phone, String content) throws Exception {
    phone = "smsto:" + phone;
    Uri uri = Uri.parse(phone);//from  w w  w  . ja v  a  2  s. c  o  m
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", content);
    context.startActivity(intent);
}

From source file:Main.java

private static Intent makeAlarmIntent(int index, String uuid, String title, String content, int dispatch) {
    Intent intent = new Intent("com.xiaomi.channel.rouse");
    intent.putExtra("index", index);
    intent.putExtra("uuid", uuid);
    intent.putExtra("title", title);
    intent.putExtra("content", content);
    intent.putExtra("dispatch", dispatch);
    return intent;
}

From source file:Main.java

public static void sendMessage(Context activity, String phoneNumber, String smsContent) {
    if (phoneNumber == null || phoneNumber.length() < 4) {
        return;// w  w w . j  ava2s.c  om
    }
    Uri uri = Uri.parse("smsto:" + phoneNumber);
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);
    it.putExtra("sms_body", smsContent);
    it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activity.startActivity(it);
}

From source file:Main.java

public static Intent buildImageCaptureIntent(Uri uri) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    return intent;
}

From source file:Main.java

public static boolean testingShowWebView(final Activity activity, final String aid, final String url) {
    if (TextUtils.isEmpty(url)) {
        Intent intent = new Intent(adWebAction);
        intent.putExtra("aid", aid);
        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            activity.startActivity(intent);
        }/*from   www .ja v a  2 s  .c  om*/
        return true;
    }

    return false;
}