List of usage examples for android.app Activity startActivityForResult
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode)
From source file:com.allen.mediautil.ImageTakerHelper.java
/** * ?/*from ww w .ja v a 2 s . c o m*/ * <p> * onActivityResult()? */ public static void openCamera(Activity activity, String authority) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(MediaStore.EXTRA_OUTPUT, getOutputPictureUri(activity.getApplicationContext(), authority)); activity.startActivityForResult(intent, REQUEST_CAMERA); }
From source file:org.sufficientlysecure.keychain.network.orbot.OrbotHelper.java
/** * First, checks whether Orbot is installed, then checks whether Orbot is * running. If Orbot is installed and not running, then an {@link Intent} is * sent to request Orbot to start, which will show the main Orbot screen. * The result will be returned in//from w ww . j a v a2 s . co m * {@link Activity#onActivityResult(int requestCode, int resultCode, Intent data)} * with a {@code requestCode} of {@code START_TOR_RESULT} * * @param activity the {@link Activity} that gets the * {@code START_TOR_RESULT} result * @return whether the start request was sent to Orbot */ public static boolean requestShowOrbotStart(Activity activity) { if (OrbotHelper.isOrbotInstalled(activity)) { if (!OrbotHelper.isOrbotRunning(activity)) { Intent intent = getShowOrbotStartIntent(); activity.startActivityForResult(intent, START_TOR_RESULT); return true; } } return false; }
From source file:ru.example.sic.my_ads.activity.MainActivity.java
public static void logIn(Activity activity) { ParseLoginBuilder builder = new ParseLoginBuilder(activity); Intent parseLoginIntent = builder//www. j a va2s . c om //.setAppLogo(R.mipmap.logo_vorschau900) .setParseLoginEnabled(true).setParseLoginButtonText(activity.getString(R.string.login_text)) .setParseLoginEmailAsUsername(true).build(); activity.startActivityForResult(parseLoginIntent, RC_LOGIN); }
From source file:com.facebook.notifications.NotificationsManager.java
/** * Present a card from the notification this activity * was relaunched from, if the notification exists. * * @param activity The activity to present from. * @param intent Intent that was used to re-launch the activity. * @return Whether or not a card was presented. *//*www .j a v a2s . com*/ public static boolean presentCardFromNotification(@NonNull Activity activity, @NonNull Intent intent) { Intent notificationIntent = intent.getParcelableExtra(EXTRA_PAYLOAD_INTENT); if (notificationIntent == null) { return false; } activity.startActivityForResult(notificationIntent, REQUEST_CODE); return true; }
From source file:com.andremion.louvre.home.GalleryActivity.java
/** * Start the Gallery Activity with additional launch information. * * @param activity Context to launch activity from. * @param requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits. * @param maxSelection The max count of image selection * @param mediaTypeFilter The media types that will display *///from ww w.j a va 2 s .c o m public static void startActivity(@NonNull Activity activity, int requestCode, @IntRange(from = 0) int maxSelection, String... mediaTypeFilter) { Intent intent = new Intent(activity, GalleryActivity.class); if (maxSelection > 0) { intent.putExtra(EXTRA_MAX_SELECTION, maxSelection); } if (mediaTypeFilter != null && mediaTypeFilter.length > 0) { intent.putExtra(EXTRA_MEDIA_TYPE_FILTER, mediaTypeFilter); } activity.startActivityForResult(intent, requestCode); }
From source file:com.github.kanata3249.ffxieq.android.MagicSelectorActivity.java
static public boolean startActivity(Activity from, int request, FFXICharacter charInfo, int index, long current, long subId) { Intent intent = new Intent(from, MagicSelectorActivity.class); intent.putExtra("Index", index); intent.putExtra("Current", current); intent.putExtra("SubId", subId); intent.putExtra("Filter", (long) -1); intent.putExtra("FilterByType", ""); from.startActivityForResult(intent, request); return true;//w w w. ja va2 s . c o m }
From source file:Main.java
private static void cropImageUri(Uri uri, int outputX, int outputY, int requestCode, Activity activity) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", outputX); intent.putExtra("outputY", outputY); intent.putExtra("scale", true); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra("return-data", false); intent.putExtra("scaleUpIfNeeded", true); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra("noFaceDetection", true); // no face detection activity.startActivityForResult(intent, requestCode); }
From source file:me.fireant.photoselect.ui.PhotoPreviewActivity.java
public static void launch(Activity activity, ArrayList<Photo> photos, int selectIndex, ArrayList<Photo> selectedPhotos, int maxSelectCount, int requestCode) { Intent intent = new Intent(activity, PhotoPreviewActivity.class); intent.putParcelableArrayListExtra(BUNDLE_PHOTOS, photos); intent.putParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS, selectedPhotos); intent.putExtra(BUNDLE_SELECT_INDEX, selectIndex); intent.putExtra(BUNDLE_MAX_SELECT_COUNT, maxSelectCount); activity.startActivityForResult(intent, requestCode); }
From source file:com.mycelium.wallet.activity.send.BroadcastTransactionActivity.java
public static void callMe(Activity currentActivity, UUID account, boolean isColdStorage, Transaction signed, String transactionLabel, int requestCode) { Intent intent = new Intent(currentActivity, BroadcastTransactionActivity.class); intent.putExtra("account", account); intent.putExtra("isColdStorage", isColdStorage); intent.putExtra("signed", signed); intent.putExtra("transactionLabel", transactionLabel); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); currentActivity.startActivityForResult(intent, requestCode); }
From source file:com.ruesga.rview.misc.ActivityHelper.java
public static void openDiffViewerActivity(Activity activity, ChangeInfo change, ArrayList<String> files, Map<String, FileInfo> info, String revisionId, String base, String current, String file, String comment, int requestCode) { Intent intent = getOpenDiffViewerActivityIntent(activity, change, files, info, revisionId, base, current, file, comment, requestCode); activity.startActivityForResult(intent, requestCode); }