android.content.Intent

Here are the examples of the java api class android.content.Intent taken from open source projects.

1. TweetUnit#getIntentFromTweet()

Project: Tweetin
Source File: TweetUnit.java
View license
public Intent getIntentFromTweet(Tweet tweet, Class<?> cls) {
    Intent intent = new Intent(activity, cls);
    intent.putExtra(activity.getString(R.string.tweet_intent_avatar_url), tweet.getAvatarURL());
    intent.putExtra(activity.getString(R.string.tweet_intent_name), tweet.getName());
    intent.putExtra(activity.getString(R.string.tweet_intent_screen_name), tweet.getScreenName());
    intent.putExtra(activity.getString(R.string.tweet_intent_created_at), tweet.getCreatedAt());
    intent.putExtra(activity.getString(R.string.tweet_intent_check_in), tweet.getCheckIn());
    intent.putExtra(activity.getString(R.string.tweet_intent_protect), tweet.isProtect());
    intent.putExtra(activity.getString(R.string.tweet_intent_picture_url), tweet.getPictureURL());
    intent.putExtra(activity.getString(R.string.tweet_intent_text), tweet.getText());
    intent.putExtra(activity.getString(R.string.tweet_intent_retweeted_by_name), tweet.getRetweetedByName());
    intent.putExtra(activity.getString(R.string.tweet_intent_favorite), tweet.isFavorite());
    intent.putExtra(activity.getString(R.string.tweet_intent_status_id), tweet.getStatusId());
    intent.putExtra(activity.getString(R.string.tweet_intent_in_reply_to_status_id), tweet.getInReplyToStatusId());
    intent.putExtra(activity.getString(R.string.tweet_intent_retweeted_by_screen_name), tweet.getRetweetedByScreenName());
    return intent;
}

2. MessageCenterService#sendGroupBinaryMessage()

View license
public static void sendGroupBinaryMessage(final Context context, String groupJid, String[] to, String mime, Uri localUri, long length, String previewPath, boolean encrypt, int compress, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", mime);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.media.uri", localUri.toString());
    i.putExtra("org.kontalk.message.length", length);
    i.putExtra("org.kontalk.message.preview.path", previewPath);
    i.putExtra("org.kontalk.message.compress", compress);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

3. MessageCenterService#sendUploadedMedia()

View license
// TODO group version
public static void sendUploadedMedia(final Context context, String to, String mime, Uri localUri, long length, String previewPath, String fetchUrl, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", mime);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.preview.uri", localUri.toString());
    i.putExtra("org.kontalk.message.length", length);
    i.putExtra("org.kontalk.message.preview.path", previewPath);
    i.putExtra("org.kontalk.message.body", fetchUrl);
    i.putExtra("org.kontalk.message.fetch.url", fetchUrl);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

4. MessageCenterService#addGroupMembers()

View license
public static void addGroupMembers(final Context context, String groupJid, String groupSubject, String[] to, String[] members, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.subject", groupSubject);
    i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_MEMBERS);
    i.putExtra("org.kontalk.message.group.add", members);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

5. MessageCenterService#removeGroupMembers()

View license
public static void removeGroupMembers(final Context context, String groupJid, String groupSubject, String[] to, String[] members, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.subject", groupSubject);
    i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_MEMBERS);
    i.putExtra("org.kontalk.message.group.remove", members);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

6. MessageCenterService#sendBinaryMessage()

View license
/** Sends a binary message. */
public static void sendBinaryMessage(final Context context, String to, String mime, Uri localUri, long length, String previewPath, boolean encrypt, int compress, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", mime);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.media.uri", localUri.toString());
    i.putExtra("org.kontalk.message.length", length);
    i.putExtra("org.kontalk.message.preview.path", previewPath);
    i.putExtra("org.kontalk.message.compress", compress);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

7. UploadFileActivity#cropImageReturnTrue()

Project: HttpTest
Source File: UploadFileActivity.java
View license
//******************************************************************************************************************************************
//																												????
//******************************************************************************************************************************************
/**
	   * ????APP???????????Uri???????????
	   */
public static void cropImageReturnTrue(Activity context, Uri uri, int desWidth, int desHeight) {
    if (uri == null)
        return;
    //??action???????????
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(uri, "image/*");
    //??????Intent?????VIEW???
    intent.putExtra("crop", "true");
    //????????????????
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra("outputX", desWidth);
    intent.putExtra("outputY", desHeight);
    //????????
    intent.putExtra("scale", true);
    intent.putExtra("scaleUpIfNeeded", true);
    //??????
    intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
    //??????????????????
    intent.putExtra("noFaceDetection", true);
    //????????????????uri????????????false??????true??????????uri?????????
    //?????????????onActivityResult??intent????????????uri??????true
    intent.putExtra("return-data", true);
    context.startActivityForResult(intent, REQUEST_CROP_IMG_CODE_TRUE);
}

8. UploadFileActivity#cropImageReturnFalse()

Project: HttpTest
Source File: UploadFileActivity.java
View license
/**
	 * ????APP???????????Uri???????????.???
	 */
public static void cropImageReturnFalse(Activity context, Uri uri, int desWidth, int desHeight) {
    if (uri == null)
        return;
    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", desWidth);
    intent.putExtra("outputY", desHeight);
    intent.putExtra("scale", true);
    //        intent.putExtra("scaleUpIfNeeded", true);
    intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
    intent.putExtra("noFaceDetection", true);
    //??????????
    intent.putExtra("return-data", false);
    //?????????uri??????????????uri??????uri???????????????????????0Byte?
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path + "temp.png")));
    context.startActivityForResult(intent, REQUEST_CROP_IMG_CODE_FALSE);
}

9. CameraActivity#cropPhoto()

Project: PracticeDemo
Source File: CameraActivity.java
View license
private void cropPhoto(Uri uri) {
    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);
    //5.1.1 ??outputX???????? ???
    intent.putExtra("outputX", 144);
    intent.putExtra("outputY", 300);
    intent.putExtra("scale", true);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    intent.putExtra("return-data", true);
    intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
    intent.putExtra("noFaceDetection", true);
    startActivityForResult(intent, CROP_PIC);
}

10. BitmapUtil#buildImageCropIntent()

Project: android-common
Source File: BitmapUtil.java
View license
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;
}

11. MessageCenterService#sendGroupTextMessage()

View license
public static void sendGroupTextMessage(final Context context, String groupJid, String groupSubject, String[] to, String text, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", TextComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.subject", groupSubject);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.body", text);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

12. MessageCenterService#createGroup()

View license
public static void createGroup(final Context context, String groupJid, String groupSubject, String[] to, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.subject", groupSubject);
    i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_CREATE);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

13. MessageCenterService#setGroupSubject()

View license
public static void setGroupSubject(final Context context, String groupJid, String groupSubject, String[] to, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.subject", groupSubject);
    i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_SUBJECT);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

14. BitmapUtil#buildImageGetIntent()

Project: android-common
Source File: BitmapUtil.java
View license
public static Intent buildImageGetIntent(Uri saveTo, int aspectX, int aspectY, int outputX, int outputY, boolean returnData) {
    Log.i(TAG, "Build.VERSION.SDK_INT : " + Build.VERSION.SDK_INT);
    Intent intent = new Intent();
    if (Build.VERSION.SDK_INT < 19) {
        intent.setAction(Intent.ACTION_GET_CONTENT);
    } else {
        intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
    }
    intent.setType("image/*");
    intent.putExtra("output", saveTo);
    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;
}

15. IntentUtils#cropImage()

Project: android-intents
Source File: IntentUtils.java
View license
/**
     * Crop image. Before using, cropImage requires especial check that differs from
     * {@link #isIntentAvailable(android.content.Context, android.content.Intent)}
     * see {@link #isCropAvailable(android.content.Context)} instead
     *
     * @param context Application context
     * @param image   Image that will be used for cropping. This image is not changed during the cropImage
     * @param outputX Output image width
     * @param outputY Output image height
     * @param aspectX Crop frame aspect X
     * @param aspectY Crop frame aspect Y
     * @param scale   Scale or not cropped image if output image and cropImage frame sizes differs
     * @return Intent with <code>data</code>-extra in <code>onActivityResult</code> which contains result as a
     * {@link android.graphics.Bitmap}. See demo app for details
     */
public static Intent cropImage(Context context, File image, int outputX, int outputY, int aspectX, int aspectY, boolean scale) {
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setType("image/*");
    List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, 0);
    ResolveInfo res = list.get(0);
    intent.putExtra("outputX", outputX);
    intent.putExtra("outputY", outputY);
    intent.putExtra("aspectX", aspectX);
    intent.putExtra("aspectY", aspectY);
    intent.putExtra("scale", scale);
    intent.putExtra("return-data", true);
    intent.setData(Uri.fromFile(image));
    intent.setComponent(new ComponentName(res.activityInfo.packageName, res.activityInfo.name));
    return intent;
}

16. MessageCenterService#leaveGroup()

View license
public static void leaveGroup(final Context context, String groupJid, String[] to, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", GroupCommandComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.group.jid", groupJid);
    i.putExtra("org.kontalk.message.group.command", GROUP_COMMAND_PART);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

17. Main#addShortcut()

Project: AmazeFileManager
Source File: Main.java
View license
private void addShortcut(Layoutelements path) {
    //Adding shortcut for MainActivity
    //on Home screen
    Intent shortcutIntent = new Intent(getActivity().getApplicationContext(), MainActivity.class);
    shortcutIntent.putExtra("path", path.getDesc());
    shortcutIntent.setAction(Intent.ACTION_MAIN);
    shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, new File(path.getDesc()).getName());
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getActivity(), R.mipmap.ic_launcher));
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    getActivity().sendBroadcast(addIntent);
}

18. CommentsListAdapter#sendToGoogleTranslate()

Project: andlytics
Source File: CommentsListAdapter.java
View license
private void sendToGoogleTranslate(String text, String displayLanguage) {
    Intent i = new Intent();
    i.setAction(Intent.ACTION_VIEW);
    i.putExtra("key_text_input", text);
    i.putExtra("key_text_output", "");
    i.putExtra("key_language_from", "auto");
    i.putExtra("key_language_to", displayLanguage);
    i.putExtra("key_suggest_translation", "");
    i.putExtra("key_from_floating_window", false);
    i.setComponent(new ComponentName("com.google.android.apps.translate", "com.google.android.apps.translate.translation.TranslateActivity"));
    context.startActivity(i);
}

19. MessageCenterService#sendTextMessage()

View license
/** Sends a text message. */
public static void sendTextMessage(final Context context, String to, String text, boolean encrypt, long msgId, String packetId) {
    Intent i = new Intent(context, MessageCenterService.class);
    i.setAction(MessageCenterService.ACTION_MESSAGE);
    i.putExtra("org.kontalk.message.msgId", msgId);
    i.putExtra("org.kontalk.message.packetId", packetId);
    i.putExtra("org.kontalk.message.mime", TextComponent.MIME_TYPE);
    i.putExtra("org.kontalk.message.to", to);
    i.putExtra("org.kontalk.message.body", text);
    i.putExtra("org.kontalk.message.encrypt", encrypt);
    i.putExtra("org.kontalk.message.chatState", ChatState.active.name());
    context.startService(i);
}

20. PullRequestFilesFragment#onClick()

Project: gh4a
Source File: PullRequestFilesFragment.java
View license
@Override
public void onClick(View v) {
    CommitFile file = (CommitFile) v.getTag();
    Intent intent = new Intent(getActivity(), FileUtils.isImage(file.getFilename()) ? FileViewerActivity.class : PullRequestDiffViewerActivity.class);
    intent.putExtra(Constants.Repository.OWNER, mRepoOwner);
    intent.putExtra(Constants.Repository.NAME, mRepoName);
    intent.putExtra(Constants.PullRequest.NUMBER, mPullRequestNumber);
    intent.putExtra(Constants.Object.REF, mHeadSha);
    intent.putExtra(Constants.Object.OBJECT_SHA, mHeadSha);
    intent.putExtra(Constants.Commit.DIFF, file.getPatch());
    intent.putExtra(Constants.Commit.COMMENTS, new ArrayList<>(mComments));
    intent.putExtra(Constants.Object.PATH, file.getFilename());
    startActivityForResult(intent, REQUEST_DIFF_VIEWER);
}

21. BigTextNotificationService#newIntent()

View license
public static Intent newIntent(AccountBean accountBean, MessageListBean mentionsWeiboData, CommentListBean commentsToMeData, CommentListBean mentionsCommentData, UnreadBean unreadBean, Intent clickNotificationToOpenAppPendingIntentInner, String ticker, int currentIndex) {
    Intent intent = new Intent(BeeboApplication.getInstance(), BigTextNotificationService.class);
    intent.putExtra(NotificationServiceHelper.ACCOUNT_ARG, accountBean);
    intent.putExtra(NotificationServiceHelper.MENTIONS_WEIBO_ARG, mentionsWeiboData);
    intent.putExtra(NotificationServiceHelper.MENTIONS_COMMENT_ARG, mentionsCommentData);
    intent.putExtra(NotificationServiceHelper.COMMENTS_TO_ME_ARG, commentsToMeData);
    intent.putExtra(NotificationServiceHelper.UNREAD_ARG, unreadBean);
    intent.putExtra(NotificationServiceHelper.CURRENT_INDEX_ARG, currentIndex);
    intent.putExtra(NotificationServiceHelper.PENDING_INTENT_INNER_ARG, clickNotificationToOpenAppPendingIntentInner);
    intent.putExtra(NotificationServiceHelper.TICKER, ticker);
    return intent;
}

22. HomeActivity#deleteShortCut()

Project: PanicButton
Source File: HomeActivity.java
View license
private void deleteShortCut() {
    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName("org.iilab.pb", "HomeActivity");
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    Intent removeIntent = new Intent();
    removeIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    removeIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "ShortcutName");
    removeIntent.putExtra("duplicate", false);
    removeIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
    sendBroadcast(removeIntent);
}

23. UserProfileActivity#startPhotoZoom()

View license
public void startPhotoZoom(Uri uri) {
    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", 300);
    intent.putExtra("outputY", 300);
    intent.putExtra("return-data", true);
    intent.putExtra("noFaceDetection", true);
    startActivityForResult(intent, REQUESTCODE_CUTTING);
}

24. BigTextNotificationService#newIntent()

View license
public static Intent newIntent(AccountBean accountBean, MessageListBean mentionsWeiboData, CommentListBean commentsToMeData, CommentListBean mentionsCommentData, UnreadBean unreadBean, Intent clickNotificationToOpenAppPendingIntentInner, String ticker, int currentIndex) {
    Intent intent = new Intent(GlobalContext.getInstance(), BigTextNotificationService.class);
    intent.putExtra(NotificationServiceHelper.ACCOUNT_ARG, accountBean);
    intent.putExtra(NotificationServiceHelper.MENTIONS_WEIBO_ARG, mentionsWeiboData);
    intent.putExtra(NotificationServiceHelper.MENTIONS_COMMENT_ARG, mentionsCommentData);
    intent.putExtra(NotificationServiceHelper.COMMENTS_TO_ME_ARG, commentsToMeData);
    intent.putExtra(NotificationServiceHelper.UNREAD_ARG, unreadBean);
    intent.putExtra(NotificationServiceHelper.CURRENT_INDEX_ARG, currentIndex);
    intent.putExtra(NotificationServiceHelper.PENDING_INTENT_INNER_ARG, clickNotificationToOpenAppPendingIntentInner);
    intent.putExtra(NotificationServiceHelper.TICKER, ticker);
    return intent;
}

25. SyncingService#broadcastSGVToUI()

Project: xDrip
Source File: SyncingService.java
View license
private void broadcastSGVToUI(EGVRecord egvRecord, boolean uploadStatus, long nextUploadTime, long displayTime, JSONArray json, int batLvl) {
    Log.d(TAG, "Current EGV: " + egvRecord.getBGValue());
    Intent broadcastIntent = new Intent();
    //        broadcastIntent.setAction(MainActivity.CGMStatusReceiver.PROCESS_RESPONSE);
    broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
    broadcastIntent.putExtra(RESPONSE_SGV, egvRecord.getBGValue());
    broadcastIntent.putExtra(RESPONSE_TREND, egvRecord.getTrend().getID());
    broadcastIntent.putExtra(RESPONSE_TIMESTAMP, egvRecord.getDisplayTime().getTime());
    broadcastIntent.putExtra(RESPONSE_NEXT_UPLOAD_TIME, nextUploadTime);
    broadcastIntent.putExtra(RESPONSE_UPLOAD_STATUS, uploadStatus);
    broadcastIntent.putExtra(RESPONSE_DISPLAY_TIME, displayTime);
    if (json != null)
        broadcastIntent.putExtra(RESPONSE_JSON, json.toString());
    broadcastIntent.putExtra(RESPONSE_BAT, batLvl);
    sendBroadcast(broadcastIntent);
}

26. BarCodeIntentIntegrator#shareText()

View license
/**
     * Shares the given text by encoding it as a barcode, such that another user can
     * scan the text off the screen of the device.
     *
     * @param text the text string to encode as a barcode
     * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
     * @return the {@link AlertDialog} that was shown to the user prompting them to download the app
     * if a prompt was needed, or null otherwise
     */
public final AlertDialog shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    if (fragment == null) {
        activity.startActivity(intent);
    } else {
        fragment.startActivity(intent);
    }
    return null;
}

27. WriteCommentActivity#startBecauseSendFailed()

Project: weiciyuan
Source File: WriteCommentActivity.java
View license
public static Intent startBecauseSendFailed(Context context, AccountBean account, String content, MessageBean oriMsg, CommentDraftBean draft, boolean comment_ori, String failedReason) {
    Intent intent = new Intent(context, WriteCommentActivity.class);
    intent.setAction(WriteCommentActivity.ACTION_SEND_FAILED);
    intent.putExtra("account", account);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("comment_ori", comment_ori);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("draft", draft);
    return intent;
}

28. WriteReplyToCommentActivity#startBecauseSendFailed()

View license
public static Intent startBecauseSendFailed(Context context, AccountBean account, String content, CommentBean oriMsg, ReplyDraftBean replyDraftBean, String repostContent, String failedReason) {
    Intent intent = new Intent(context, WriteReplyToCommentActivity.class);
    intent.setAction(WriteReplyToCommentActivity.ACTION_SEND_FAILED);
    intent.putExtra("account", account);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("repostContent", repostContent);
    intent.putExtra("replyDraftBean", replyDraftBean);
    return intent;
}

29. WriteWeiboActivity#startBecauseSendFailed()

Project: weiciyuan
Source File: WriteWeiboActivity.java
View license
public static Intent startBecauseSendFailed(Context context, AccountBean accountBean, String content, String picPath, GeoBean geoBean, StatusDraftBean statusDraftBean, String failedReason) {
    Intent intent = new Intent(context, WriteWeiboActivity.class);
    intent.setAction(WriteWeiboActivity.ACTION_SEND_FAILED);
    intent.putExtra("account", accountBean);
    intent.putExtra("content", content);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("picPath", picPath);
    intent.putExtra("geoBean", geoBean);
    intent.putExtra("statusDraftBean", statusDraftBean);
    return intent;
}

30. IntentIntegrator#shareText()

Project: zxing
Source File: IntentIntegrator.java
View license
/**
   * Shares the given text by encoding it as a barcode, such that another user can
   * scan the text off the screen of the device.
   *
   * @param text the text string to encode as a barcode
   * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
   * @return the {@link AlertDialog} that was shown to the user prompting them to download the app
   *   if a prompt was needed, or null otherwise
   */
public final AlertDialog shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    if (fragment == null) {
        activity.startActivity(intent);
    } else {
        fragment.startActivity(intent);
    }
    return null;
}

31. MainListAdapter#createDetailsIntent()

Project: andlytics
Source File: MainListAdapter.java
View license
private Intent createDetailsIntent(AppInfo appInfo, File iconFile, ChartSet chartSet, int selectedTab) {
    Intent intent = new Intent(activity, DetailsActivity.class);
    intent.putExtra(BaseActivity.EXTRA_PACKAGE_NAME, appInfo.getPackageName());
    intent.putExtra(DetailsActivity.EXTRA_CHART_NAME, R.string.ratings);
    if (iconFile.exists()) {
        intent.putExtra(BaseActivity.EXTRA_ICON_FILE, iconFile.getAbsolutePath());
    }
    intent.putExtra(BaseActivity.EXTRA_AUTH_ACCOUNT_NAME, accountname);
    intent.putExtra(BaseActivity.EXTRA_DEVELOPER_ID, appInfo.getDeveloperId());
    intent.putExtra(DetailsActivity.EXTRA_CHART_SET, chartSet.name());
    intent.putExtra(DetailsActivity.EXTRA_SELECTED_TAB_IDX, selectedTab);
    RevenueSummary revenue = appInfo.getTotalRevenueSummary();
    boolean hasRevenue = revenue != null && revenue.hasRevenue();
    intent.putExtra(DetailsActivity.EXTRA_HAS_REVENUE, hasRevenue);
    return intent;
}

32. DfuInitiatorActivity#onDeviceSelected()

View license
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
    final Intent intent = getIntent();
    final String overwrittenName = intent.getStringExtra(DfuService.EXTRA_DEVICE_NAME);
    final String path = intent.getStringExtra(DfuService.EXTRA_FILE_PATH);
    final String initPath = intent.getStringExtra(DfuService.EXTRA_INIT_FILE_PATH);
    final String address = device.getAddress();
    final String finalName = overwrittenName == null ? (name != null ? name : getString(R.string.not_available)) : overwrittenName;
    final int type = intent.getIntExtra(DfuService.EXTRA_FILE_TYPE, DfuService.TYPE_AUTO);
    final boolean keepBond = intent.getBooleanExtra(DfuService.EXTRA_KEEP_BOND, false);
    // Start DFU service with data provided in the intent
    final Intent service = new Intent(this, DfuService.class);
    service.putExtra(DfuService.EXTRA_DEVICE_ADDRESS, address);
    service.putExtra(DfuService.EXTRA_DEVICE_NAME, finalName);
    service.putExtra(DfuService.EXTRA_FILE_TYPE, type);
    service.putExtra(DfuService.EXTRA_FILE_PATH, path);
    if (intent.hasExtra(DfuService.EXTRA_INIT_FILE_PATH))
        service.putExtra(DfuService.EXTRA_INIT_FILE_PATH, initPath);
    service.putExtra(DfuService.EXTRA_KEEP_BOND, keepBond);
    startService(service);
    finish();
}

33. CommonUtil#startPhotoZoom()

Project: Android-ZBLibrary
Source File: CommonUtil.java
View license
/**????
	 * @param context
	 * @param requestCode
	 * @param fromFile
	 * @param width
	 * @param height
	 */
public static void startPhotoZoom(Activity context, int requestCode, Uri fileUri, int width, int height) {
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(fileUri, "image/*");
    // crop?true???????intent??????view????
    intent.putExtra("crop", "true");
    // aspectX aspectY ??????
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    // outputX,outputY ????????
    intent.putExtra("outputX", width);
    intent.putExtra("outputY", height);
    intent.putExtra("return-data", true);
    Log.i(TAG, "startPhotoZoom" + fileUri + " uri");
    toActivity(context, intent, requestCode);
}

34. CommonUtil#startPhotoZoom()

Project: Android-ZBLibrary
Source File: CommonUtil.java
View license
/**????
	 * @param context
	 * @param requestCode
	 * @param fromFile
	 * @param width
	 * @param height
	 */
public static void startPhotoZoom(Activity context, int requestCode, Uri fileUri, int width, int height) {
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(fileUri, "image/*");
    // crop?true???????intent??????view????
    intent.putExtra("crop", "true");
    // aspectX aspectY ??????
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    // outputX,outputY ????????
    intent.putExtra("outputX", width);
    intent.putExtra("outputY", height);
    intent.putExtra("return-data", true);
    Log.i(TAG, "startPhotoZoom" + fileUri + " uri");
    toActivity(context, intent, requestCode);
}

35. RemoteService#getCreateAccountIntent()

Project: apg
Source File: RemoteService.java
View license
/**
     * Deprecated API
     */
protected Intent getCreateAccountIntent(Intent data, String accountName) {
    String packageName = getCurrentCallingPackage();
    Log.d(Constants.TAG, "getCreateAccountIntent accountName: " + accountName);
    Intent intent = new Intent(getBaseContext(), RemoteServiceActivity.class);
    intent.setAction(RemoteServiceActivity.ACTION_CREATE_ACCOUNT);
    intent.putExtra(RemoteServiceActivity.EXTRA_PACKAGE_NAME, packageName);
    intent.putExtra(RemoteServiceActivity.EXTRA_ACC_NAME, accountName);
    intent.putExtra(RemoteServiceActivity.EXTRA_DATA, data);
    PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    // return PendingIntent to be executed by client
    Intent result = new Intent();
    result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
    result.putExtra(OpenPgpApi.RESULT_INTENT, pi);
    return result;
}

36. Notifications#requestNotification()

Project: astrid
Source File: Notifications.java
View license
private static void requestNotification(long taskId, Intent intent, int type, String title, String text, int ringTimes) {
    Context context = ContextManager.getContext();
    Intent inAppNotify = new Intent(BROADCAST_IN_APP_NOTIFY);
    inAppNotify.putExtra(EXTRAS_NOTIF_ID, (int) taskId);
    inAppNotify.putExtra(NotificationFragment.TOKEN_ID, taskId);
    inAppNotify.putExtra(EXTRAS_CUSTOM_INTENT, intent);
    inAppNotify.putExtra(EXTRAS_TYPE, type);
    inAppNotify.putExtra(EXTRAS_TITLE, title);
    inAppNotify.putExtra(EXTRAS_TEXT, text);
    inAppNotify.putExtra(EXTRAS_RING_TIMES, ringTimes);
    if (forceNotificationManager)
        new ShowNotificationReceiver().onReceive(ContextManager.getContext(), inAppNotify);
    else
        context.sendOrderedBroadcast(inAppNotify, AstridApiConstants.PERMISSION_READ);
}

37. BubbleFlowDraggable#passUrlToActivity()

View license
private void passUrlToActivity(OpenUrlSettings urlToOpen) {
    Intent intent = new Intent(BubbleFlowActivity.ACTIVITY_INTENT_NAME);
    intent.putExtra("command", BubbleFlowActivity.OPEN_URL);
    intent.putExtra("url", urlToOpen.mUrl);
    intent.putExtra("urlStartTime", urlToOpen.mUrlLoadStartTime);
    intent.putExtra("hasShownAppPicker", urlToOpen.mHasShownAppPicker);
    intent.putExtra("performEmptyClick", urlToOpen.mPerformEmptyClick);
    intent.putExtra("setAsCurrentTab", urlToOpen.mSetAsCurrentTab);
    intent.putExtra("openedFromItself", urlToOpen.mOpenedFromItself);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext());
    bm.sendBroadcast(intent);
}

38. MyScanActivity#onScanPress()

View license
public void onScanPress(View v) {
    // This method is set up as an onClick handler in the layout xml
    // e.g. android:onClick="onScanPress"
    Intent scanIntent = new Intent(this, CardIOActivity.class);
    // customize these values to suit your needs.
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false);
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false);
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_RESTRICT_POSTAL_CODE_TO_NUMERIC_ONLY, false);
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME, false);
    // hides the manual entry button
    // if set, developers should provide their own manual entry mechanism in the app
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false);
    // matches the theme of your application
    // default: false
    scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, false);
    // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
    startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}

39. IntentIntegrator#shareText()

View license
/**
   * Shares the given text by encoding it as a barcode, such that another user can
   * scan the text off the screen of the device.
   *
   * @param text the text string to encode as a barcode
   * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
   * @return the {@link AlertDialog} that was shown to the user prompting them to download the app
   *   if a prompt was needed, or null otherwise
   */
public final AlertDialog shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    activity.startActivity(intent);
    return null;
}

40. IntentIntegrator#shareText()

Project: CodenameOne
Source File: IntentIntegrator.java
View license
/**
     * Shares the given text by encoding it as a barcode, such that another user
     * can scan the text off the screen of the device.
     *
     * @param text the text string to encode as a barcode
     * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type}
     * constants.
     * to download the app if a prompt was needed, or null otherwise
     */
public boolean shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        showDownloadDialog();
        return false;
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    activity.startActivity(intent);
    return true;
}

41. IntentIntegrator#shareText()

Project: doctorAndroid
Source File: IntentIntegrator.java
View license
/**
     * Shares the given text by encoding it as a barcode, such that another user can
     * scan the text off the screen of the device.
     *
     * @param text the text string to encode as a barcode
     * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
     * @return the {@link AlertDialog} that was shown to the user prompting them to download the app
     *   if a prompt was needed, or null otherwise
     */
public final AlertDialog shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    if (fragment == null) {
        activity.startActivity(intent);
    } else {
        fragment.startActivity(intent);
    }
    return null;
}

42. FanfouServiceManager#doFetchTimeline()

View license
private static void doFetchTimeline(final Context context, final int type, final Messenger messenger, final int page, final String userId, final String sinceId, final String maxId) {
    final Intent intent = new Intent(context, FanFouService.class);
    intent.putExtra(Constants.EXTRA_TYPE, type);
    intent.putExtra(Constants.EXTRA_MESSENGER, messenger);
    intent.putExtra(Constants.EXTRA_COUNT, Constants.MAX_TIMELINE_COUNT);
    intent.putExtra(Constants.EXTRA_PAGE, page);
    intent.putExtra(Constants.EXTRA_ID, userId);
    intent.putExtra(Constants.EXTRA_SINCE_ID, sinceId);
    intent.putExtra(Constants.EXTRA_MAX_ID, maxId);
    if (AppContext.DEBUG) {
        Log.d(FanfouServiceManager.TAG, "doFetchTimeline() type=" + type + " page=" + page + " userId=" + userId);
    }
    context.startService(intent);
}

43. IntentIntegrator#shareText()

View license
/**
     * Shares the given text by encoding it as a barcode, such that another user can
     * scan the text off the screen of the device.
     *
     * @param text the text string to encode as a barcode
     * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type}
     *             constants.
     * @return the {@link AlertDialog} that was shown to the user prompting them to download the app
     * if a prompt was needed, or null otherwise
     */
public final AlertDialog shareText(CharSequence text, CharSequence type) {
    Intent intent = new Intent();
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(BS_PACKAGE + ".ENCODE");
    intent.putExtra("ENCODE_TYPE", type);
    intent.putExtra("ENCODE_DATA", text);
    String targetAppPackage = findTargetAppPackage(intent);
    if (targetAppPackage == null) {
        return showDownloadDialog();
    }
    intent.setPackage(targetAppPackage);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    attachMoreExtras(intent);
    activity.startActivity(intent);
    return null;
}

44. WriteCommentActivity#startBecauseSendFailed()

Project: iBeebo
Source File: WriteCommentActivity.java
View license
public static Intent startBecauseSendFailed(Context context, AccountBean account, String content, MessageBean oriMsg, CommentDraftBean draft, boolean comment_ori, String failedReason) {
    Intent intent = new Intent(context, WriteCommentActivity.class);
    intent.setAction(WriteCommentActivity.ACTION_SEND_FAILED);
    intent.putExtra(Constants.ACCOUNT, account);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("comment_ori", comment_ori);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("draft", draft);
    return intent;
}

45. WriteReplyToCommentActivity#startBecauseSendFailed()

View license
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // getMenuInflater().inflate(R.menu.actionbar_menu_commentnewactivity, menu);
// menu.findItem(R.id.menu_enable_ori_comment).setVisible(false);
// menu.findItem(R.id.menu_enable_repost).setVisible(true);
// enableRepost = menu.findItem(R.id.menu_enable_repost);
// enableRepost.setChecked(savedEnableRepost);
// return true;
// }
public static Intent startBecauseSendFailed(Context context, AccountBean account, String content, CommentBean oriMsg, ReplyDraftBean replyDraftBean, String repostContent, String failedReason) {
    Intent intent = new Intent(context, WriteReplyToCommentActivity.class);
    intent.setAction(WriteReplyToCommentActivity.ACTION_SEND_FAILED);
    intent.putExtra(Constants.ACCOUNT, account);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("repostContent", repostContent);
    intent.putExtra("replyDraftBean", replyDraftBean);
    return intent;
}

46. WriteWeiboWithAppSrcActivity#startBecauseSendFailed()

View license
public static Intent startBecauseSendFailed(Context context, AccountBean accountBean, String content, String picPath, GeoBean geoBean, StatusDraftBean statusDraftBean, String failedReason) {
    Intent intent = new Intent(context, WriteWeiboWithAppSrcActivity.class);
    intent.setAction(ACTION_SEND_FAILED);
    intent.putExtra(Constants.ACCOUNT, accountBean);
    intent.putExtra("content", content);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("picPath", picPath);
    intent.putExtra("geoBean", geoBean);
    intent.putExtra("statusDraftBean", statusDraftBean);
    return intent;
}

47. ViewUtils#createDeskShortCut()

Project: KJFrameForAndroid
Source File: ViewUtils.java
View license
/**
     * ??????
     * 
     * @param cxt
     *            Context
     * @param icon
     *            ??????
     * @param title
     *            ??????
     * @param cls
     *            ?????
     */
public void createDeskShortCut(Context cxt, int icon, String title, Class<?> cls) {
    // ???????Intent
    Intent shortcutIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    // ???????
    shortcutIntent.putExtra("duplicate", false);
    // ???????
    shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, title);
    // ????
    Parcelable ico = Intent.ShortcutIconResource.fromContext(cxt.getApplicationContext(), icon);
    shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, ico);
    Intent intent = new Intent(cxt, cls);
    // ????????????????????????????
    intent.setAction("android.intent.action.MAIN");
    intent.addCategory("android.intent.category.LAUNCHER");
    // ???????????????
    shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
    // ?????OK
    cxt.sendBroadcast(shortcutIntent);
}

48. PicCutDemoActivity#startPhotoZoom()

View license
/**
 * ό???
 * 
 * @param uri
 */
public void startPhotoZoom(Uri uri) {
    /*
 * IntentACTIONτ?????·΅?
 * yourself_sdk_path/docs/reference/android/content/Intent.html
 * ?Ctrl+F?CROP ??ϋ?????????ό, ???
 */
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(uri, "image/*");
    // crop=true?Intent?VIEW?ό
    intent.putExtra("crop", "true");
    // aspectX aspectY ???
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    // outputX outputY ?ό??
    intent.putExtra("outputX", 80);
    intent.putExtra("outputY", 80);
    intent.putExtra("return-data", true);
    startActivityForResult(intent, 3);
}

49. Services#scheduledComplexNotification()

Project: mHealthDroid
Source File: Services.java
View license
/**
	 * Method that scheduled a complex notification
	 * @see sendComplexNotification
	 * @param title The title of the notificacion 
	 * @param text The text that the notification will show
	 * @param notificationId The notification's id
	 * @param flags The notification's flags
	 * @param contentIntent The intent that will be runned when the notification is cliked
	 * @param icon The icon that will show the notification
	 * @param context The UI Activity Context
	 * @param date Day and hour when the notification will be thrown
	 */
public void scheduledComplexNotification(String title, String text, int notificationId, int flags, PendingIntent contentIntent, int icon, Context context, Calendar date) {
    Intent intent = new Intent(context, ScheduledTask.class);
    Bundle bundle = new Bundle();
    bundle.putParcelable("intent", contentIntent);
    intent.putExtra("title", title);
    intent.putExtra("text", text);
    intent.putExtra("icon", icon);
    intent.putExtra("notificationID", notificationId);
    intent.putExtra("flags", flags);
    intent.putExtra("bundle", bundle);
    intent.putExtra("type", 2);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, date.getTimeInMillis(), pendingIntent);
}

50. Services#scheduledComplexNotificationCustomSound()

Project: mHealthDroid
Source File: Services.java
View license
/**
	 * Method that scheduled a complex notification with a customized sound
	 * @see sendComplexNotificationCustomSound
	 * @param title The title of the notificacion 
	 * @param text The text that the notification will show
	 * @param notificationId The notification's id
	 * @param flags The notification's flags
	 * @param contentIntent The intent that will be runned when the notification is cliked
	 * @param soundUri The sound that will be played when the notification is sent
	 * @param icon The icon that will show the notification
	 * @param context The UI Activity Context
	 * @param date Day and hour when the notification will be thrown
	 */
public void scheduledComplexNotificationCustomSound(String title, String text, int notificationId, int flags, PendingIntent contentIntent, Uri soundUri, int icon, Context context, Calendar date) {
    Intent intent = new Intent(context, ScheduledTask.class);
    Bundle bundle = new Bundle();
    bundle.putParcelable("intent", contentIntent);
    bundle.putParcelable("sound", soundUri);
    intent.putExtra("title", title);
    intent.putExtra("text", text);
    intent.putExtra("icon", icon);
    intent.putExtra("notificationID", notificationId);
    intent.putExtra("flags", flags);
    intent.putExtra("bundle", bundle);
    intent.putExtra("type", 3);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.RTC_WAKEUP, date.getTimeInMillis(), pendingIntent);
}

51. AddNetworkFilesourceDialog#attemptLogin()

View license
private void attemptLogin() {
    Intent intent = new Intent();
    intent.setClass(getApplicationContext(), FileSourceBrowser.class);
    intent.putExtra(USER, mUser);
    intent.putExtra(PASSWORD, mPass);
    intent.putExtra(DOMAIN, mDomain);
    intent.putExtra(SERVER, mServer);
    intent.putExtra(TYPE, isMovie ? MOVIE : TV_SHOW);
    intent.putExtra(FILESOURCE, FileSource.SMB);
    startActivity(intent);
    finish();
}

52. ShortcutHelper#addShortcut()

Project: Omni-Notes
Source File: ShortcutHelper.java
View license
/**
     * Adding shortcut on Home screen
     */
public static void addShortcut(Context context, Note note) {
    Intent shortcutIntent = new Intent(context, MainActivity.class);
    shortcutIntent.putExtra(Constants.INTENT_KEY, note.get_id());
    shortcutIntent.setAction(Constants.ACTION_SHORTCUT);
    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    String shortcutTitle = note.getTitle().length() > 0 ? note.getTitle() : DateHelper.getFormattedDate(note.getCreation(), OmniNotes.getSharedPreferences().getBoolean(Constants.PREF_PRETTIFIED_DATES, true));
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutTitle);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.ic_shortcut));
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    context.sendBroadcast(addIntent);
}

53. PictureActivity#launchPhoto()

Project: actor-platform
Source File: PictureActivity.java
View license
public static void launchPhoto(Activity activity, View transitionView, String path, int senderId) {
    Intent intent = new Intent(activity, PictureActivity.class);
    intent.putExtra(ARG_FILE_PATH, path);
    intent.putExtra(ARG_OWNER, senderId);
    int[] location = new int[2];
    transitionView.getLocationInWindow(location);
    intent.putExtra(ARG_IMAGE_TOP, location[1]);
    intent.putExtra(ARG_IMAGE_LEFT, location[0]);
    intent.putExtra(ARG_IMAGE_WIDTH, transitionView.getWidth());
    intent.putExtra(ARG_IMAGE_HEIGHT, transitionView.getHeight());
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
}

54. IntentActivityFlags#buildIntentsToViewsLists()

View license
/**
     * This creates an array of Intent objects representing the back stack
     * for a user going into the Views/Lists API demos.
     */
private Intent[] buildIntentsToViewsLists() {
    // We are going to rebuild our task with a new back stack.  This will
    // be done by launching an array of Intents, representing the new
    // back stack to be created, with the first entry holding the root
    // and requesting to reset the back stack.
    Intent[] intents = new Intent[3];
    // First: root activity of ApiDemos.
    // This is a convenient way to make the proper Intent to launch and
    // reset an application's task.
    intents[0] = Intent.makeRestartActivityTask(new ComponentName(this, com.example.android.apis.ApiDemos.class));
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
    intent.putExtra("com.example.android.apis.Path", "Views");
    intents[1] = intent;
    intent = new Intent(Intent.ACTION_MAIN);
    intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
    intent.putExtra("com.example.android.apis.Path", "Views/Lists");
    intents[2] = intent;
    return intents;
}

55. LauncherShortcuts#setupShortcut()

View license
/**
     * This function creates a shortcut and returns it to the caller.  There are actually two 
     * intents that you will send back.
     * 
     * The first intent serves as a container for the shortcut and is returned to the launcher by 
     * setResult().  This intent must contain three fields:
     * 
     * <ul>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_INTENT} The shortcut intent.</li>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_NAME} The text that will be displayed with
     * the shortcut.</li>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_ICON} The shortcut's icon, if provided as a
     * bitmap, <i>or</i> {@link android.content.Intent#EXTRA_SHORTCUT_ICON_RESOURCE} if provided as
     * a drawable resource.</li>
     * </ul>
     * 
     * If you use a simple drawable resource, note that you must wrapper it using
     * {@link android.content.Intent.ShortcutIconResource}, as shown below.  This is required so
     * that the launcher can access resources that are stored in your application's .apk file.  If 
     * you return a bitmap, such as a thumbnail, you can simply put the bitmap into the extras 
     * bundle using {@link android.content.Intent#EXTRA_SHORTCUT_ICON}.
     * 
     * The shortcut intent can be any intent that you wish the launcher to send, when the user 
     * clicks on the shortcut.  Typically this will be {@link android.content.Intent#ACTION_VIEW} 
     * with an appropriate Uri for your content, but any Intent will work here as long as it 
     * triggers the desired action within your Activity.
     */
private void setupShortcut() {
    // First, set up the shortcut intent.  For this example, we simply create an intent that
    // will bring us directly back to this activity.  A more typical implementation would use a 
    // data Uri in order to display a more specific result, or a custom action in order to 
    // launch a specific operation.
    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName(this, this.getClass().getName());
    shortcutIntent.putExtra(EXTRA_KEY, "ApiDemos Provided This Shortcut");
    // Then, set up the container intent (the response to the caller)
    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name));
    Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.app_sample_code);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
    // Now, return the result to the launcher
    setResult(RESULT_OK, intent);
}

56. MainActivity#getDetailActivityStartIntent()

Project: android-unsplash
Source File: MainActivity.java
View license
@NonNull
private static Intent getDetailActivityStartIntent(Activity host, ArrayList<Photo> photos, int position, PhotoItemBinding binding) {
    final Intent intent = new Intent(host, DetailActivity.class);
    intent.setAction(Intent.ACTION_VIEW);
    intent.putParcelableArrayListExtra(IntentUtil.PHOTO, photos);
    intent.putExtra(IntentUtil.SELECTED_ITEM_POSITION, position);
    intent.putExtra(IntentUtil.FONT_SIZE, binding.author.getTextSize());
    intent.putExtra(IntentUtil.PADDING, new Rect(binding.author.getPaddingLeft(), binding.author.getPaddingTop(), binding.author.getPaddingRight(), binding.author.getPaddingBottom()));
    intent.putExtra(IntentUtil.TEXT_COLOR, binding.author.getCurrentTextColor());
    return intent;
}

57. CommonMusicAppReceiverTest#testParseFromIntentExtras()

View license
public void testParseFromIntentExtras() {
    Track track = TestTrackFactory.newTrackWithRandomData();
    Intent intent = new Intent();
    intent.putExtra(CommonMusicAppReceiver.EXTRA_PLAYER_PACKAGE_NAME, track.getPlayerPackageName());
    intent.putExtra(CommonMusicAppReceiver.EXTRA_TRACK, track.getTrack());
    intent.putExtra(CommonMusicAppReceiver.EXTRA_ARTIST, track.getArtist());
    intent.putExtra(CommonMusicAppReceiver.EXTRA_ALBUM, track.getAlbum());
    intent.putExtra(CommonMusicAppReceiver.EXTRA_DURATION, track.getDuration());
    intent.putExtra(CommonMusicAppReceiver.EXTRA_TIMESTAMP, track.getTimestamp());
    Track parsedTrack = CommonMusicAppReceiver.parseFromIntentExtras(intent);
    assertEquals(track.getPlayerPackageName(), parsedTrack.getPlayerPackageName());
    assertEquals(track.getTrack(), parsedTrack.getTrack());
    assertEquals(track.getArtist(), parsedTrack.getArtist());
    assertEquals(track.getAlbum(), parsedTrack.getAlbum());
    assertEquals(track.getDuration(), parsedTrack.getDuration());
    assertEquals(track.getTimestamp(), parsedTrack.getTimestamp());
}

58. ShortCutUtil#addShortcut()

Project: AndroidStudyDemo
Source File: ShortCutUtil.java
View license
/**
     * ???????????
     *
     * @param activity Activity
     */
public static void addShortcut(Activity activity) {
    Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    // ???????
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getString(R.string.app_name));
    // ???????
    shortcut.putExtra("duplicate", false);
    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName(activity, activity.getClass().getName());
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    // ???????
    ShortcutIconResource iconRes = ShortcutIconResource.fromContext(activity, R.drawable.ic_launcher);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes);
    activity.sendBroadcast(shortcut);
}

59. OpenPgpService#getSignKeyIdImpl()

Project: apg
Source File: OpenPgpService.java
View license
private Intent getSignKeyIdImpl(Intent data) {
    String preferredUserId = data.getStringExtra(OpenPgpApi.EXTRA_USER_ID);
    Intent intent = new Intent(getBaseContext(), SelectSignKeyIdActivity.class);
    String currentPkg = getCurrentCallingPackage();
    intent.setData(KeychainContract.ApiApps.buildByPackageNameUri(currentPkg));
    intent.putExtra(SelectSignKeyIdActivity.EXTRA_USER_ID, preferredUserId);
    intent.putExtra(SelectSignKeyIdActivity.EXTRA_DATA, data);
    PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    // return PendingIntent to be executed by client
    Intent result = new Intent();
    result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
    result.putExtra(OpenPgpApi.RESULT_INTENT, pi);
    return result;
}

60. PassphraseCacheService#addCachedPassphrase()

Project: apg
Source File: PassphraseCacheService.java
View license
/**
     * This caches a new passphrase in memory by sending a new command to the service. An android
     * service is only run once. Thus, when the service is already started, new commands just add
     * new events to the alarm manager for new passphrases to let them timeout in the future.
     */
public static void addCachedPassphrase(Context context, long masterKeyId, long subKeyId, Passphrase passphrase, String primaryUserId) {
    Log.d(Constants.TAG, "PassphraseCacheService.addCachedPassphrase() for " + masterKeyId);
    Intent intent = new Intent(context, PassphraseCacheService.class);
    intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
    intent.putExtra(EXTRA_TTL, Preferences.getPreferences(context).getPassphraseCacheTtl());
    intent.putExtra(EXTRA_PASSPHRASE, passphrase);
    intent.putExtra(EXTRA_KEY_ID, masterKeyId);
    intent.putExtra(EXTRA_SUBKEY_ID, subKeyId);
    intent.putExtra(EXTRA_USER_ID, primaryUserId);
    context.startService(intent);
}

61. AudioCallInputProvider#onActivityResult()

View license
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }
    final Conversation conversation = getCurrentConversation();
    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase());
    intent.putExtra("targetId", conversation.getTargetId());
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(getContext().getPackageName());
    getContext().getApplicationContext().startActivity(intent);
}

62. VideoCallInputProvider#onActivityResult()

View license
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }
    final Conversation conversation = getCurrentConversation();
    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase());
    intent.putExtra("targetId", conversation.getTargetId());
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(getContext().getPackageName());
    getContext().getApplicationContext().startActivity(intent);
}

63. CGeoMap#mapRestart()

Project: cgeo
Source File: CGeoMap.java
View license
/**
     * Restart the current activity with the default map source.
     */
private void mapRestart() {
    // prepare information to restart a similar view
    final Intent mapIntent = new Intent(activity, Settings.getMapProvider().getMapClass());
    mapIntent.putExtra(Intents.EXTRA_SEARCH, searchIntent);
    mapIntent.putExtra(Intents.EXTRA_GEOCODE, geocodeIntent);
    if (coordsIntent != null) {
        mapIntent.putExtra(Intents.EXTRA_COORDS, coordsIntent);
    }
    mapIntent.putExtra(Intents.EXTRA_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
    mapIntent.putExtra(Intents.EXTRA_TITLE, mapTitle);
    mapIntent.putExtra(Intents.EXTRA_MAP_MODE, mapMode);
    mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, isLiveEnabled);
    final int[] mapState = currentMapState();
    if (mapState != null) {
        mapIntent.putExtra(Intents.EXTRA_MAPSTATE, mapState);
    }
    // close old map
    activity.finish();
    // start the new map
    activity.startActivity(mapIntent);
}

64. MwmRequest#toIntent()

Project: cgeo
Source File: MwmRequest.java
View license
public Intent toIntent(Context context) {
    final Intent mwmIntent = new Intent(Const.ACTION_MWM_REQUEST);
    // url
    final String mwmUrl = createMwmUrl(context, mTitle, mZoomLevel, mPoints).toString();
    mwmIntent.putExtra(Const.EXTRA_URL, mwmUrl);
    // title
    mwmIntent.putExtra(Const.EXTRA_TITLE, mTitle);
    // more
    mwmIntent.putExtra(Const.EXTRA_RETURN_ON_BALLOON_CLICK, mReturnOnBalloonClick);
    // pick point
    mwmIntent.putExtra(Const.EXTRA_PICK_POINT, mPickPoint);
    // custom button name
    mwmIntent.putExtra(Const.EXTRA_CUSTOM_BUTTON_NAME, mCustomButtonName);
    final boolean hasIntent = mPendingIntent != null;
    mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent);
    if (hasIntent)
        mwmIntent.putExtra(Const.EXTRA_CALLER_PENDING_INTENT, mPendingIntent);
    addCommonExtras(context, mwmIntent);
    return mwmIntent;
}

65. IntentActivityFlags#buildIntentsToViewsLists()

View license
/**
     * This creates an array of Intent objects representing the back stack
     * for a user going into the Views/Lists API demos.
     */
private Intent[] buildIntentsToViewsLists() {
    // We are going to rebuild our task with a new back stack.  This will
    // be done by launching an array of Intents, representing the new
    // back stack to be created, with the first entry holding the root
    // and requesting to reset the back stack.
    Intent[] intents = new Intent[3];
    // First: root activity of ApiDemos.
    // This is a convenient way to make the proper Intent to launch and
    // reset an application's task.
    intents[0] = Intent.makeRestartActivityTask(new ComponentName(this, com.example.android.apis.ApiDemos.class));
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
    intent.putExtra("com.example.android.apis.Path", "Views");
    intents[1] = intent;
    intent = new Intent(Intent.ACTION_MAIN);
    intent.setClass(IntentActivityFlags.this, com.example.android.apis.ApiDemos.class);
    intent.putExtra("com.example.android.apis.Path", "Views/Lists");
    intents[2] = intent;
    return intents;
}

66. LauncherShortcuts#setupShortcut()

View license
/**
     * This function creates a shortcut and returns it to the caller.  There are actually two 
     * intents that you will send back.
     * 
     * The first intent serves as a container for the shortcut and is returned to the launcher by 
     * setResult().  This intent must contain three fields:
     * 
     * <ul>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_INTENT} The shortcut intent.</li>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_NAME} The text that will be displayed with
     * the shortcut.</li>
     * <li>{@link android.content.Intent#EXTRA_SHORTCUT_ICON} The shortcut's icon, if provided as a
     * bitmap, <i>or</i> {@link android.content.Intent#EXTRA_SHORTCUT_ICON_RESOURCE} if provided as
     * a drawable resource.</li>
     * </ul>
     * 
     * If you use a simple drawable resource, note that you must wrapper it using
     * {@link android.content.Intent.ShortcutIconResource}, as shown below.  This is required so
     * that the launcher can access resources that are stored in your application's .apk file.  If 
     * you return a bitmap, such as a thumbnail, you can simply put the bitmap into the extras 
     * bundle using {@link android.content.Intent#EXTRA_SHORTCUT_ICON}.
     * 
     * The shortcut intent can be any intent that you wish the launcher to send, when the user 
     * clicks on the shortcut.  Typically this will be {@link android.content.Intent#ACTION_VIEW} 
     * with an appropriate Uri for your content, but any Intent will work here as long as it 
     * triggers the desired action within your Activity.
     */
private void setupShortcut() {
    // First, set up the shortcut intent.  For this example, we simply create an intent that
    // will bring us directly back to this activity.  A more typical implementation would use a 
    // data Uri in order to display a more specific result, or a custom action in order to 
    // launch a specific operation.
    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName(this, this.getClass().getName());
    shortcutIntent.putExtra(EXTRA_KEY, "ApiDemos Provided This Shortcut");
    // Then, set up the container intent (the response to the caller)
    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name));
    Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.app_sample_code);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
    // Now, return the result to the launcher
    setResult(RESULT_OK, intent);
}

67. MyGcmListenerService#sentMessageToIntent()

View license
public void sentMessageToIntent(final String meetingRoom, final String callerName, final String mode, final String phone) {
    Log.d(TAG, "testingbysaikat");
    //        Intent intent = new Intent();
    //        intent.setAction("RESULT_RECEIVER");
    //        intent.putExtra("ROOM_NAME", meetingRoom);
    //        intent.putExtra("CALLER_NAME", callerName);
    //        intent.putExtra("MODE", mode);
    //        sendBroadcast(intent);
    Intent i = new Intent(getApplicationContext(), RingToneService.class);
    i.setAction(RingToneService.ACTION_START);
    i.putExtra("ROOM_NAME", meetingRoom);
    i.putExtra("CALLER_NAME", callerName);
    i.putExtra("MODE", mode);
    i.putExtra("PHONE", phone);
    i.putExtra("OPONENT_ID", OPONENT_ID);
    startService(i);
}

68. ShareUtils#qq()

Project: ExhibitionCenter
Source File: ShareUtils.java
View license
public void qq(Uri image) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("image/*");
    intent.putExtra(Intent.EXTRA_TEXT, shareText);
    intent.putExtra(Intent.EXTRA_SUBJECT, shareText);
    intent.putExtra(Intent.EXTRA_STREAM, image);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    //intent.setComponent(new ComponentName("com.tencent.mobileqq", "android/com.android.internal.app.ResolverActivity"));
    intent.setComponent(new ComponentName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.JumpActivity"));
    context.startActivity(intent);
}

69. PreferenceActivity#onBuildStartFragmentIntent()

View license
public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setClass(this, getClass());
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_TITLE, titleRes);
    intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_SHORT_TITLE, shortTitleRes);
    intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
    return intent;
}

70. MainTimeLineActivity#unReadIntent()

Project: iBeebo
Source File: MainTimeLineActivity.java
View license
/**
     * ?????Intent
     *
     * @param accountBean
     * @param mentionsWeiboData
     * @param mentionsCommentData
     * @param commentsToMeData
     * @param unreadBean
     * @return
     */
public static Intent unReadIntent(AccountBean accountBean, MessageListBean mentionsWeiboData, CommentListBean mentionsCommentData, CommentListBean commentsToMeData, UnreadBean unreadBean) {
    Intent intent = new Intent(BeeboApplication.getInstance(), NotifyActivity.class);
    intent.putExtra(BundleArgsConstants.ACCOUNT_EXTRA, accountBean);
    intent.putExtra(BundleArgsConstants.MENTIONS_WEIBO_EXTRA, mentionsWeiboData);
    intent.putExtra(BundleArgsConstants.MENTIONS_COMMENT_EXTRA, mentionsCommentData);
    intent.putExtra(BundleArgsConstants.COMMENTS_TO_ME_EXTRA, commentsToMeData);
    intent.putExtra(BundleArgsConstants.UNREAD_EXTRA, unreadBean);
    intent.putExtra(BundleArgsConstants.FromUnReadIntent, true);
    return intent;
}

71. RepostWeiboWithAppSrcActivity#startBecauseSendFailed()

View license
public static Intent startBecauseSendFailed(Context context, AccountBean accountBean, String content, MessageBean oriMsg, RepostDraftBean repostDraftBean, String failedReason) {
    Intent intent = new Intent(context, RepostWeiboWithAppSrcActivity.class);
    intent.setAction(WriteRepostActivity.ACTION_SEND_FAILED);
    intent.putExtra(Constants.ACCOUNT, accountBean);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("repostDraftBean", repostDraftBean);
    return intent;
}

72. WriteRepostActivity#startBecauseSendFailed()

Project: iBeebo
Source File: WriteRepostActivity.java
View license
public static Intent startBecauseSendFailed(Context context, AccountBean accountBean, String content, MessageBean oriMsg, RepostDraftBean repostDraftBean, String failedReason) {
    Intent intent = new Intent(context, WriteRepostActivity.class);
    intent.setAction(WriteRepostActivity.ACTION_SEND_FAILED);
    intent.putExtra(Constants.ACCOUNT, accountBean);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("repostDraftBean", repostDraftBean);
    return intent;
}

73. FetchNewMsgService#sendTwoKindsOfBroadcast()

Project: iBeebo
Source File: FetchNewMsgService.java
View license
private void sendTwoKindsOfBroadcast(AccountBean accountBean, CommentListBean commentResult, MessageListBean mentionStatusesResult, CommentListBean mentionCommentsResult, UnreadBean unreadBean) {
    Intent intent = new Intent(AppEventAction.UnRead_Message_Action);
    intent.putExtra(BundleArgsConstants.ACCOUNT_EXTRA, accountBean);
    intent.putExtra(BundleArgsConstants.COMMENTS_TO_ME_EXTRA, commentResult);
    intent.putExtra(BundleArgsConstants.MENTIONS_WEIBO_EXTRA, mentionStatusesResult);
    intent.putExtra(BundleArgsConstants.MENTIONS_COMMENT_EXTRA, mentionCommentsResult);
    intent.putExtra(BundleArgsConstants.UNREAD_EXTRA, unreadBean);
    sendOrderedBroadcast(intent, null);
    intent.setAction(AppEventAction.NEW_MSG_BROADCAST);
    LocalBroadcastManager.getInstance(getBaseContext()).sendBroadcast(intent);
}

74. NovelInfoActivity#viewChapter()

View license
private void viewChapter(int vid, int cid) {
    // to new activity
    Intent intent = new Intent();
    intent.setClass(parentActivity, NovelReaderActivity.class);
    intent.putExtra("aid", aid);
    intent.putExtra("vid", vid);
    intent.putExtra("cid", cid);
    intent.putExtra("from", from);
    // force convert
    intent.putExtra("volumes", (Serializable) vl);
    startActivity(intent);
    overridePendingTransition(R.anim.in_from_right, R.anim.keep);
    return;
}

75. NovelInfoActivity#viewChapter()

View license
private void viewChapter(int vid, int cid) {
    // to new activity
    Intent intent = new Intent();
    intent.setClass(parentActivity, NovelReaderActivity.class);
    intent.putExtra("aid", aid);
    intent.putExtra("vid", vid);
    intent.putExtra("cid", cid);
    intent.putExtra("from", from);
    // force convert
    intent.putExtra("volumes", (Serializable) vl);
    startActivity(intent);
    overridePendingTransition(R.anim.in_from_right, R.anim.keep);
    return;
}

76. PhotoDetailActivity#start()

View license
public static void start(Activity activity, View transitionView, Photo photo) {
    Intent intent = new Intent(activity, PhotoDetailActivity.class);
    intent.putExtra(Photo.class.getSimpleName(), photo);
    int[] screenLocation = new int[2];
    transitionView.getLocationOnScreen(screenLocation);
    int orientation = activity.getResources().getConfiguration().orientation;
    intent.putExtra(EXTRA_ORIENTATION, orientation);
    intent.putExtra(EXTRA_LEFT, screenLocation[0]);
    intent.putExtra(EXTRA_TOP, screenLocation[1]);
    intent.putExtra(EXTRA_WIDTH, transitionView.getWidth());
    intent.putExtra(EXTRA_HEIGHT, transitionView.getHeight());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity);
        activity.startActivity(intent, options.toBundle());
    } else {
        activity.startActivity(intent);
    }
    activity.overridePendingTransition(0, R.anim.activity_fade_out);
}

77. BaseActivity#handleUncaughtException()

View license
protected void handleUncaughtException(Thread thread, Throwable e) {
    Log.d("Report :: ", ErrorUtil.getErrorReport(e));
    String cause = ErrorUtil.getCause(e);
    String errorType = ErrorUtil.getExceptionType(e);
    String stackTrace = ErrorUtil.getStrackTrace(e);
    String deviceInfo = ErrorUtil.getDeviceInfo();
    Intent i = new Intent(getApplicationContext(), ErrorActivity.class);
    i.putExtra(ErrorActivity.EXCEPTION_TYPE_ARG, errorType);
    i.putExtra(ErrorActivity.STACKTRACE_ARG, stackTrace);
    i.putExtra(ErrorActivity.DEVICE_INFO_ARG, deviceInfo);
    i.putExtra(ErrorActivity.CAUSE_ARG, cause);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
    System.exit(0);
}

78. ShortcutHelper#removeshortCut()

Project: Omni-Notes
Source File: ShortcutHelper.java
View license
/**
     * Removes note shortcut from home launcher
     */
public static void removeshortCut(Context context, Note note) {
    Intent shortcutIntent = new Intent(context, MainActivity.class);
    shortcutIntent.putExtra(Constants.INTENT_KEY, note.get_id());
    shortcutIntent.setAction(Constants.ACTION_SHORTCUT);
    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    String shortcutTitle = note.getTitle().length() > 0 ? note.getTitle() : DateHelper.getFormattedDate(note.getCreation(), OmniNotes.getSharedPreferences().getBoolean(Constants.PREF_PRETTIFIED_DATES, true));
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutTitle);
    addIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
    context.sendBroadcast(addIntent);
}

79. PassphraseCacheService#addCachedPassphrase()

View license
/**
     * This caches a new passphrase in memory by sending a new command to the service. An android
     * service is only run once. Thus, when the service is already started, new commands just add
     * new events to the alarm manager for new passphrases to let them timeout in the future.
     */
public static void addCachedPassphrase(Context context, long masterKeyId, long subKeyId, Passphrase passphrase, String primaryUserId, int timeToLiveSeconds) {
    Log.d(Constants.TAG, "PassphraseCacheService.addCachedPassphrase() for " + masterKeyId);
    Intent intent = new Intent(context, PassphraseCacheService.class);
    intent.setAction(ACTION_PASSPHRASE_CACHE_ADD);
    intent.putExtra(EXTRA_TTL, timeToLiveSeconds);
    intent.putExtra(EXTRA_PASSPHRASE, passphrase);
    intent.putExtra(EXTRA_KEY_ID, masterKeyId);
    intent.putExtra(EXTRA_SUBKEY_ID, subKeyId);
    intent.putExtra(EXTRA_USER_ID, primaryUserId);
    context.startService(intent);
}

80. ShareFragment#share()

View license
public void share() {
    Loggable.UserAction userAction = new Loggable.UserAction(Loggable.Key.ACTION_SHARE);
    Logger.track(userAction);
    mCallback.onRequestLaunchShareAction();
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    // this causes issues with gmail
    //shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    File file = new File(mShareableUri);
    Uri uri = Uri.fromFile(file);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    shareIntent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.share_text_template));
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.share_subject_template));
    shareIntent.setType("image/*");
    shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    startActivityForResult(Intent.createChooser(shareIntent, getResources().getString(R.string.share_action_description)), SHARE_REQUEST_CODE);
}

81. CoreBaseActivity#handleUncaughtException()

View license
protected void handleUncaughtException(Thread thread, Throwable e) {
    Log.d("Report :: ", ErrorUtil.getErrorReport(e));
    String cause = ErrorUtil.getCause(e);
    String errorType = ErrorUtil.getExceptionType(e);
    String stackTrace = ErrorUtil.getStrackTrace(e);
    String deviceInfo = ErrorUtil.getDeviceInfo();
    Intent i = new Intent(getApplicationContext(), ErrorActivity.class);
    i.putExtra(ErrorActivity.EXCEPTION_TYPE_ARG, errorType);
    i.putExtra(ErrorActivity.STACKTRACE_ARG, stackTrace);
    i.putExtra(ErrorActivity.DEVICE_INFO_ARG, deviceInfo);
    i.putExtra(ErrorActivity.CAUSE_ARG, cause);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(i);
    System.exit(0);
}

82. TransportrUtils#findDirections()

Project: Transportr
Source File: TransportrUtils.java
View license
public static void findDirections(Context context, Location from, Location via, Location to, Date date) {
    Intent intent = new Intent(context, MainActivity.class);
    intent.setAction(DirectionsFragment.TAG);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    intent.putExtra("from", from);
    intent.putExtra("via", via);
    intent.putExtra("to", to);
    intent.putExtra("search", true);
    if (date != null) {
        intent.putExtra("date", date);
    }
    context.startActivity(intent);
}

83. WriteRepostActivity#startBecauseSendFailed()

Project: weiciyuan
Source File: WriteRepostActivity.java
View license
public static Intent startBecauseSendFailed(Context context, AccountBean accountBean, String content, MessageBean oriMsg, RepostDraftBean repostDraftBean, String failedReason) {
    Intent intent = new Intent(context, WriteRepostActivity.class);
    intent.setAction(WriteRepostActivity.ACTION_SEND_FAILED);
    intent.putExtra("account", accountBean);
    intent.putExtra("content", content);
    intent.putExtra("oriMsg", oriMsg);
    intent.putExtra("failedReason", failedReason);
    intent.putExtra("repostDraftBean", repostDraftBean);
    return intent;
}

84. CreateSecurityTokenImportResetFragment#onQueuedOperationSuccess()

View license
@Override
public void onQueuedOperationSuccess(ImportKeyResult result) {
    long[] masterKeyIds = result.getImportedMasterKeyIds();
    if (masterKeyIds.length == 0) {
        super.onCryptoOperationError(result);
        return;
    }
    // null-protected from Queueing*Fragment
    Activity activity = getActivity();
    Intent intent = new Intent(activity, ViewKeyActivity.class);
    // use the imported masterKeyId, not the one from the token, because
    // that one might* just have been a subkey of the imported key
    intent.setData(KeyRings.buildGenericKeyRingUri(masterKeyIds[0]));
    intent.putExtra(ViewKeyActivity.EXTRA_DISPLAY_RESULT, result);
    intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_AID, mTokenAid);
    intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_USER_ID, mTokenUserId);
    intent.putExtra(ViewKeyActivity.EXTRA_SECURITY_TOKEN_FINGERPRINTS, mTokenFingerprints);
    startActivity(intent);
    activity.finish();
}

85. FileManagerFragment#viewFile()

Project: Protocoder
Source File: FileManagerFragment.java
View license
private void viewFile(int index) {
    MimeTypeMap myMime = MimeTypeMap.getSingleton();
    Intent newIntent = new Intent(android.content.Intent.ACTION_VIEW);
    // Intent newIntent = new Intent(Intent.ACTION_VIEW);
    String mimeType = myMime.getMimeTypeFromExtension(fileExt(files.get(index).getName()).substring(1));
    newIntent.setDataAndType(Uri.fromFile(files.get(index)), mimeType);
    newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
        getActivity().startActivity(newIntent);
    } catch (android.content.ActivityNotFoundException e) {
        Toast.makeText(getActivity(), "No handler for this type of file.", Toast.LENGTH_LONG).show();
    }
    Intent myIntent = new Intent(Intent.ACTION_VIEW);
    myIntent.setData(Uri.fromFile(files.get(index)));
    Intent j = Intent.createChooser(myIntent, "Choose an application to open with:");
    startActivity(j);
}

86. NewConversationActivity#onContactSelected()

View license
@Override
public void onContactSelected(String number) {
    Recipients recipients = RecipientFactory.getRecipientsFromString(this, number, true);
    Intent intent = new Intent(this, ConversationActivity.class);
    intent.putExtra(ConversationActivity.RECIPIENTS_EXTRA, recipients.getIds());
    intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA));
    intent.setDataAndType(getIntent().getData(), getIntent().getType());
    long existingThread = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(recipients);
    intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, existingThread);
    intent.putExtra(ConversationActivity.DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT);
    startActivity(intent);
    finish();
}

87. TalkBackUpdateHelper#notifyUserOfBuiltInGestureChanges()

Project: talkback
Source File: TalkBackUpdateHelper.java
View license
private void notifyUserOfBuiltInGestureChanges() {
    // Build the intent for when the notification is clicked.
    final Intent notificationIntent = new Intent(mService, NotificationActivity.class);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    notificationIntent.putExtra(NotificationActivity.EXTRA_INT_DIALOG_TITLE, R.string.notification_title_talkback_gestures_changed);
    notificationIntent.putExtra(NotificationActivity.EXTRA_INT_DIALOG_MESSAGE, R.string.talkback_built_in_gesture_change_details);
    notificationIntent.putExtra(NotificationActivity.EXTRA_INT_NOTIFICATION_ID, BUILT_IN_GESTURE_CHANGE_NOTIFICATION_ID);
    NotificationPosterRunnable runnable = new NotificationPosterRunnable(buildGestureChangeNotification(notificationIntent), BUILT_IN_GESTURE_CHANGE_NOTIFICATION_ID);
    mHandler.postDelayed(runnable, NOTIFICATION_DELAY);
}

88. AddTask#setupShortcut()

Project: todo.txt-android
Source File: AddTask.java
View license
private void setupShortcut() {
    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName(this, this.getClass().getName());
    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_addtask_name));
    Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.todotxt_touch_icon);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
    setResult(RESULT_OK, intent);
}

89. FileSystemAdapter#createData()

Project: vanilla
Source File: FileSystemAdapter.java
View license
@Override
public Intent createData(View view) {
    ViewHolder holder = (ViewHolder) view.getTag();
    File file = mFiles[(int) holder.id];
    Intent intent = new Intent();
    intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_FILE);
    intent.putExtra(LibraryAdapter.DATA_ID, holder.id);
    intent.putExtra(LibraryAdapter.DATA_TITLE, holder.text.getText().toString());
    intent.putExtra(LibraryAdapter.DATA_EXPANDABLE, file.isDirectory());
    String path;
    try {
        path = file.getCanonicalPath();
    } catch (IOException e) {
        path = file.getAbsolutePath();
        Log.e("VanillaMusic", "Failed to canonicalize path", e);
    }
    intent.putExtra(LibraryAdapter.DATA_FILE, path);
    return intent;
}

90. VideoPlayerActivity#start()

View license
private static void start(Context context, Uri uri, String title, boolean fromStart, int openedPosition) {
    Intent intent = new Intent(context, VideoPlayerActivity.class);
    intent.setAction(PLAY_FROM_VIDEOGRID);
    intent.putExtra(PLAY_EXTRA_ITEM_LOCATION, uri);
    intent.putExtra(PLAY_EXTRA_ITEM_TITLE, title);
    intent.putExtra(PLAY_EXTRA_FROM_START, fromStart);
    intent.putExtra(PLAY_EXTRA_OPENED_POSITION, openedPosition);
    if (openedPosition != -1)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    context.startActivity(intent);
}

91. PlaybackService#broadcastMetadata()

Project: VCL-Android
Source File: PlaybackService.java
View license
private void broadcastMetadata() {
    MediaWrapper media = getCurrentMedia();
    if (media == null || media.getType() != MediaWrapper.TYPE_AUDIO)
        return;
    boolean playing = mMediaPlayer.isPlaying();
    Intent broadcast = new Intent("com.android.music.metachanged");
    broadcast.putExtra("track", media.getTitle());
    broadcast.putExtra("artist", media.getArtist());
    broadcast.putExtra("album", media.getAlbum());
    broadcast.putExtra("duration", media.getLength());
    broadcast.putExtra("playing", playing);
    sendBroadcast(broadcast);
}

92. NewHtcHomeBadger#executeBadge()

View license
@Override
protected void executeBadge(int badgeCount) throws ShortcutBadgeException {
    Intent intent1 = new Intent(INTENT_SET_NOTIFICATION);
    ComponentName localComponentName = new ComponentName(getContextPackageName(), getEntryActivityName());
    intent1.putExtra(EXTRA_COMPONENT, localComponentName.flattenToShortString());
    intent1.putExtra(EXTRA_COUNT, badgeCount);
    mContext.sendBroadcast(intent1);
    Intent intent = new Intent(INTENT_UPDATE_SHORTCUT);
    intent.putExtra(PACKAGENAME, getContextPackageName());
    intent.putExtra(COUNT, badgeCount);
    mContext.sendBroadcast(intent);
}

93. CopyService#generateNotification()

Project: AmazeFileManager
Source File: CopyService.java
View license
void generateNotification(ArrayList<HFile> failedOps, boolean move) {
    if (failedOps.size() == 0)
        return;
    mNotifyManager.cancelAll();
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(c);
    mBuilder.setContentTitle("Operation Unsuccessful");
    mBuilder.setContentText("Some files weren't %s successfully".replace("%s", move ? "moved" : "copied"));
    Intent intent = new Intent(this, MainActivity.class);
    intent.putExtra("failedOps", failedOps);
    intent.putExtra("move", move);
    PendingIntent pIntent = PendingIntent.getActivity(this, 101, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(pIntent);
    mBuilder.setSmallIcon(R.drawable.ic_content_copy_white_36dp);
    mNotifyManager.notify(741, mBuilder.build());
    intent = new Intent("general_communications");
    intent.putExtra("failedOps", failedOps);
    intent.putExtra("move", move);
    sendBroadcast(intent);
}

94. FileOperationsHelper#unshareFileViaLink()

Project: android
Source File: FileOperationsHelper.java
View license
/**
     * Helper method to unshare a file publicly shared via link.
     * Starts a request to do it in {@link OperationsService}
     *
     * @param file      The file to unshare.
     */
public void unshareFileViaLink(OCFile file) {
    // Unshare the file: Create the intent
    Intent unshareService = new Intent(mFileActivity, OperationsService.class);
    unshareService.setAction(OperationsService.ACTION_UNSHARE);
    unshareService.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
    unshareService.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
    unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, ShareType.PUBLIC_LINK);
    unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, "");
    queueShareIntent(unshareService);
}

95. FileOperationsHelper#unshareFileWithUserOrGroup()

Project: android
Source File: FileOperationsHelper.java
View license
public void unshareFileWithUserOrGroup(OCFile file, ShareType shareType, String userOrGroup) {
    // Unshare the file: Create the intent
    Intent unshareService = new Intent(mFileActivity, OperationsService.class);
    unshareService.setAction(OperationsService.ACTION_UNSHARE);
    unshareService.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
    unshareService.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
    unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, shareType);
    unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, userOrGroup);
    queueShareIntent(unshareService);
}

96. LastActivityListener#processPacket()

View license
@Override
public void processPacket(Stanza packet) {
    LastActivity p = (LastActivity) packet;
    Intent i = new Intent(ACTION_LAST_ACTIVITY);
    i.putExtra(EXTRA_PACKET_ID, p.getStanzaId());
    i.putExtra(EXTRA_TYPE, p.getType().toString());
    i.putExtra(EXTRA_FROM, p.getFrom());
    i.putExtra(EXTRA_TO, p.getTo());
    i.putExtra(EXTRA_SECONDS, p.getIdleTime());
    XMPPError.Condition errCondition = XMPPUtils.getErrorCondition(packet);
    if (errCondition != null)
        i.putExtra(EXTRA_ERROR_CONDITION, errCondition.toString());
    sendBroadcast(i);
}

97. VersionListener#processPacket()

Project: androidclient
Source File: VersionListener.java
View license
@Override
public void processPacket(Stanza packet) {
    Version p = (Version) packet;
    Intent i = new Intent(ACTION_VERSION);
    i.putExtra(EXTRA_PACKET_ID, p.getStanzaId());
    i.putExtra(EXTRA_FROM, p.getFrom());
    i.putExtra(EXTRA_TO, p.getTo());
    i.putExtra(EXTRA_VERSION_NAME, p.getName());
    i.putExtra(EXTRA_VERSION_NUMBER, p.getVersion());
    sendBroadcast(i);
}

98. share#sendEmail()

Project: AndroidQuickUtils
Source File: share.java
View license
/**
     * Share via Email
     *
     * @param email     destination email (e.g. support@company.com)
     * @param subject   email subject
     * @param emailBody email body
     */
public static void sendEmail(String email, String subject, String emailBody) {
    Intent emailIntent = new Intent(Intent.ACTION_SEND);
    emailIntent.setType("message/rfc822");
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { email });
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody);
    emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
        QuickUtils.getContext().startActivity(emailIntent);
    } catch (android.content.ActivityNotFoundException ex) {
        QuickUtils.system.toast("There are no email clients installed.");
    }
}

99. DialogLifecycleHelper#cancelDialogCall()

View license
private void cancelDialogCall() {
    Intent pendingIntent = dialogCall.getRequestIntent();
    Intent cancelIntent = new Intent();
    cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID, pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
    cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION, pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
    cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
    cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);
    FacebookDialog.handleActivityResult(activity, dialogCall, dialogCall.getRequestCode(), cancelIntent, onDialogReturn);
    dialogCall = null;
}

100. HtcBadgeProvider#setBadge()

Project: Badges
Source File: HtcBadgeProvider.java
View license
@Override
public void setBadge(int count) {
    Intent intent = new Intent("com.htc.launcher.action.UPDATE_SHORTCUT");
    intent.putExtra("packagename", getPackageName());
    intent.putExtra("count", count);
    mContext.sendBroadcast(intent);
    Intent setNotificationIntent = new Intent("com.htc.launcher.action.SET_NOTIFICATION");
    ComponentName componentName = new ComponentName(getPackageName(), getMainActivityClassName());
    setNotificationIntent.putExtra("com.htc.launcher.extra.COMPONENT", componentName.flattenToShortString());
    setNotificationIntent.putExtra("com.htc.launcher.extra.COUNT", count);
    mContext.sendBroadcast(setNotificationIntent);
}