List of usage examples for android.app Activity startActivityForResult
public void startActivityForResult(@RequiresPermission Intent intent, int requestCode)
From source file:com.keepassdroid.PasswordActivity.java
public static void Launch(Activity act, String fileName, String keyFile) throws FileNotFoundException { if (EmptyUtils.isNullOrEmpty(fileName)) { throw new FileNotFoundException(); }//from w ww.java2 s. c om Uri uri = UriUtil.parseDefaultFile(fileName); String scheme = uri.getScheme(); if (!EmptyUtils.isNullOrEmpty(scheme) && scheme.equalsIgnoreCase("file")) { File dbFile = new File(uri.getPath()); if (!dbFile.exists()) { throw new FileNotFoundException(); } } Intent i = new Intent(act, PasswordActivity.class); i.putExtra(KEY_FILENAME, fileName); i.putExtra(KEY_KEYFILE, keyFile); act.startActivityForResult(i, 0); }
From source file:com.xunlei.shortvideo.activity.VideoPublishLocal3Activity.java
public static void startActivityForResult(Activity activity, ShortVideo video, Uri uri, String topic, int code) { Intent intent = new Intent(activity, VideoPublishLocal3Activity.class); intent.putExtra(EXTRA_SHORT_VIDEO, video); intent.putExtra(EXTRA_TOPIC, topic); intent.putExtra(EXTRA_VIDEO_PROJECT, uri); activity.startActivityForResult(intent, code); }
From source file:com.miz.utils.ViewUtils.java
/** * Returns a TV show season card with title, release date, image and click listener. * @param context/* w w w.j a v a2s . c om*/ * @param picasso * @param season * @return */ @SuppressLint("InflateParams") public static View setupTvShowSeasonCard(final Activity context, Picasso picasso, final GridSeason season, final int toolbarColor) { final View v = LayoutInflater.from(context).inflate(R.layout.horizontal_grid_item_small, null); // Load image picasso.load(season.getCover()).placeholder(R.color.card_background_dark).error(R.drawable.loading_image) .config(MizuuApplication.getBitmapConfig()).into(((ImageView) v.findViewById(R.id.cover))); // Set title ((TextView) v.findViewById(R.id.text)).setText(season.getHeaderText()); ((TextView) v.findViewById(R.id.text)).setTypeface(TypefaceUtils.getRobotoMedium(context)); // Set subtitle ((TextView) v.findViewById(R.id.gridCoverSubtitle)).setText(season.getSimpleSubtitleText()); ((TextView) v.findViewById(R.id.gridCoverSubtitle)).setSingleLine(true); // Set click listener v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.startActivityForResult(IntentUtils.getTvShowSeasonIntent(context, season.getShowId(), season.getSeason(), season.getEpisodeCount(), toolbarColor), 0); } }); return v; }
From source file:io.flutter.plugins.imagepicker.ImagePickerPlugin.java
private void pickImageFromGallery(Activity activity) { boolean hasPermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; if (hasPermission) { Intent pickImageIntent = new Intent(Intent.ACTION_GET_CONTENT); pickImageIntent.setType("image/*"); activity.startActivityForResult(pickImageIntent, REQUEST_CODE_PICK); } else {//w w w.ja v a 2 s. com requestReadExternalStoragePermission(); } }
From source file:com.eleybourn.bookcatalogue.BookEdit.java
/** * Load the EditBook tab activity in read-only mode. The first tab is book * details./*from w w w . java2 s . co m*/ * * @param a * current activity from which we start * @param id * The id of the book to view * @param listTable * (Optional) name of the temp table comtaining a list of book * IDs. * @param position * (Optional) position in underlying book list. Only used in * read-only view. */ public static void viewBook(Activity a, long id, String listTable, Integer position) { Intent i = new Intent(a, BookEdit.class); i.putExtra("FlattenedBooklist", listTable); if (position != null) { i.putExtra("FlattenedBooklistPosition", position); } i.putExtra(CatalogueDBAdapter.KEY_ROWID, id); i.putExtra(BookEdit.TAB, BookEdit.TAB_EDIT); // needed extra for // creating BookEdit i.putExtra(BookEdit.KEY_READ_ONLY, true); a.startActivityForResult(i, UniqueId.ACTIVITY_VIEW_BOOK); return; }
From source file:com.enstage.wibmo.sdk.inapp.InAppInitActivity.java
public static void startInAppFlowInApp(Activity activity, W2faInitRequest w2faInitRequest, W2faInitResponse w2faInitResponse) { Intent intent = new Intent(WibmoSDK.getWibmoIntentActionPackage() + ".InApp"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("W2faInitRequest", w2faInitRequest); intent.putExtra("W2faInitResponse", w2faInitResponse); /*/*from ww w . j a v a 2 s .c o m*/ String targetAppPackage = WibmoSDK.getWibmoPackage(); boolean flag = WibmoSDK.isPackageExisted(activity, targetAppPackage); if (flag==false) { WibmoSDK.showDownloadDialog(activity); } */ if (readyPackage != null) { intent.setPackage(readyPackage); } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); //causes to iap to be cancelled when app returned by icon launch activity.startActivityForResult(intent, WibmoSDK.REQUEST_CODE_IAP_2FA); }
From source file:com.enstage.wibmo.sdk.inapp.InAppInitActivity.java
public static void startInAppFlowInApp(Activity activity, WPayInitRequest wPayInitRequest, WPayInitResponse wPayInitResponse) { Intent intent = new Intent(WibmoSDK.getWibmoIntentActionPackage() + ".InApp"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("WPayInitRequest", wPayInitRequest); intent.putExtra("WPayInitResponse", wPayInitResponse); /*// www. j a v a 2 s .co m String targetAppPackage = WibmoSDK.getWibmoPackage(); boolean flag = WibmoSDK.isPackageExisted(activity, targetAppPackage); if (flag==false) { WibmoSDK.showDownloadDialog(activity); } */ if (readyPackage != null) { intent.setPackage(readyPackage); } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); //causes to iap to be cancelled when app returned by icon launch activity.startActivityForResult(intent, WibmoSDK.REQUEST_CODE_IAP_PAY); }
From source file:com.xbm.android.matisse.SelectionCreator.java
/** * Start to select media and wait for result. * * @param requestCode Identity of the request Activity or Fragment. *//* www. j ava 2 s .co m*/ public void forResult(int requestCode) { Activity activity = mMatisse.getActivity(); if (activity == null) { return; } Intent intent = new Intent(activity, MatisseActivity.class); Fragment fragment = mMatisse.getFragment(); if (fragment != null) { fragment.startActivityForResult(intent, requestCode); } else { activity.startActivityForResult(intent, requestCode); } }
From source file:com.groundupworks.wings.gcp.GoogleCloudPrintEndpoint.java
@Override public void startLinkRequest(final Activity activity, final Fragment fragment) { if (fragment != null) { fragment.startActivityForResult(new Intent(activity, GoogleCloudPrintSettingsActivity.class), REQUEST_CODE);/*from w w w . j a v a2 s. com*/ } else { activity.startActivityForResult(new Intent(activity, GoogleCloudPrintSettingsActivity.class), REQUEST_CODE); } }
From source file:com.amazonaws.mobile.auth.google.GoogleSignInProvider.java
private void initiateGoogleSignIn(final Activity signInActivity) { Log.d(LOG_TAG, "Launching sign-in activity."); final Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); signInActivity.startActivityForResult(signInIntent, RC_SIGN_IN); }