List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:Main.java
public static Intent newCalendarIntent(Context context, Date startDate, String title, String location, String note) {/*from www. j a va 2s .co m*/ Calendar cal = Calendar.getInstance(); cal.setTime(startDate); Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", cal.getTimeInMillis()); intent.putExtra("endTime", cal.getTimeInMillis() + 60 * 60 * 1000); intent.putExtra("allDay", true); //intent.putExtra("rrule", "FREQ=WEEKLY;COUNT="+numWeeks); //intent.putExtra("rrule", "FREQ=YEARLY"); intent.putExtra("title", title); intent.putExtra("eventLocation", location); intent.putExtra("description", note); //intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE); //intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY); return intent; }
From source file:Main.java
public static void sendBroadcast(Context context, String filter, String name, String value, String name1, String value1) {//from w w w. jav a 2 s . c o m Intent intent = new Intent(); intent.putExtra(name, value); intent.putExtra(name1, value1); intent.setAction(filter); if (mLocalBroadcastManager == null) { getLocalBroadcastManager(context.getApplicationContext()); } mLocalBroadcastManager.sendBroadcast(intent); }
From source file:Main.java
public static Intent buildImageCropIntent(Uri uriFrom, Uri uriTo, int aspectX, int aspectY, int outputX, int outputY, boolean returnData) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uriFrom, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("output", uriTo); intent.putExtra("aspectX", aspectX); intent.putExtra("aspectY", aspectY); intent.putExtra("outputX", outputX); intent.putExtra("outputY", outputY); intent.putExtra("scale", true); intent.putExtra("return-data", returnData); intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString()); return intent; }
From source file:Main.java
public static Intent createTakePictureIntent(@NonNull Context context, @NonNull Uri outputFileUri) { List<Intent> cameraIntents = createTakePictureIntentList(context, outputFileUri); if (cameraIntents.isEmpty()) return null; Intent chooserIntent = new Intent(cameraIntents.get(0)); cameraIntents.remove(0);/* w w w. j av a 2s . c om*/ chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[cameraIntents.size()])); return chooserIntent; }
From source file:Main.java
public static void shareViaEmail(Context context, String subject, String text) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/html"); intent.setData(Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_SUBJECT, subject); context.startActivity(Intent.createChooser(intent, "Share via Email")); }
From source file:Main.java
/** * Send an email via available mail activity * /*from w w w.j a va 2s . com*/ * @param context the app context * @param to the email address send to * @param subject the email subject * @param body the email body */ public static void sendEmail(Context context, String to, String subject, String body) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", to, null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, body); context.startActivity(Intent.createChooser(emailIntent, null)); }
From source file:Main.java
/** * Returns an implicit intent for opening QuickContacts. *///from w w w .ja va 2s . c om public static Intent composeQuickContactIntent(Uri contactLookupUri, int extraMode) { final Intent intent = new Intent(QuickContact.ACTION_QUICK_CONTACT); intent.setData(contactLookupUri); intent.putExtra(QuickContact.EXTRA_MODE, extraMode); // Make sure not to show QuickContacts on top of another QuickContacts. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; }
From source file:Main.java
private static void cropImageUri(Uri uri, int outputX, int outputY, int requestCode, Activity activity) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", outputX); intent.putExtra("outputY", outputY); intent.putExtra("scale", true); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra("return-data", false); intent.putExtra("scaleUpIfNeeded", true); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra("noFaceDetection", true); // no face detection activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void openVideo(Context mContext, String videoPath) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("oneshot", 0); intent.putExtra("configchange", 0); Uri uri = Uri.fromFile(new File(videoPath)); intent.setDataAndType(uri, "video/*"); mContext.startActivity(intent);/*from w w w . ja va 2 s . c o m*/ }
From source file:Main.java
public static Intent getAppStoreLink(Context context, String installerPackageName, String packageName) { Intent intent = new Intent(Intent.ACTION_SHOW_APP_INFO).setPackage(installerPackageName); final Intent result = resolveIntent(context, intent); if (result != null) { result.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName); return result; }//from www . j av a2 s .co m return null; }