Example usage for android.app Activity startActivityForResult

List of usage examples for android.app Activity startActivityForResult

Introduction

In this page you can find the example usage for android.app Activity startActivityForResult.

Prototype

public void startActivityForResult(@RequiresPermission Intent intent, int requestCode) 

Source Link

Document

Same as calling #startActivityForResult(Intent,int,Bundle) with no options.

Usage

From source file:com.kaliturin.blacklist.activities.CustomFragmentActivity.java

public static void show(Activity context, String activityTitle, Class<? extends Fragment> fragmentClass,
        Bundle fragmentArguments, int requestCode) {
    Intent intent = getIntent(context, activityTitle, fragmentClass, fragmentArguments);
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openAlbum(Activity activity, int requestCode) {
    Intent intent;//from   w  ww  . j  ava2 s.  c  om
    if (Build.VERSION.SDK_INT < 19) {
        intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("image/*");

    } else {
        intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    }
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void openActivity(Activity activity, Intent intent, int requestCode, int enterAnim,
        int exitAnim) {
    if (null == activity)
        return;//w  w  w  . j  av a 2s.c  om

    if (requestCode < 0) {
        activity.startActivity(intent);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }

    if (enterAnim > 0 && exitAnim > 0) {
        activity.overridePendingTransition(enterAnim, exitAnim);
    }
}

From source file:com.google.android.apps.forscience.whistlepunk.PictureUtils.java

public static String capturePictureLabel(final Activity activity) {
    return capturePictureLabel(activity, new IStartable() {
        @Override// w  w  w .  ja v a  2s. c o  m
        public void startActivityForResult(Intent intent, int requestCode) {
            activity.startActivityForResult(intent, requestCode);
        }
    });
}

From source file:Main.java

public static AlertDialog initOrbot(Activity activity, CharSequence stringTitle, CharSequence stringMessage,
        CharSequence stringButtonYes, CharSequence stringButtonNo, CharSequence stringDesiredBarcodeFormats) {
    Intent intentScan = new Intent("org.torproject.android.START_TOR");
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);

    try {//from ww w.  j  av  a  2s .c  om
        activity.startActivityForResult(intentScan, REQUEST_CODE);
        return null;
    } catch (ActivityNotFoundException e) {
        return showDownloadDialog(activity, stringTitle, stringMessage, stringButtonYes, stringButtonNo);
    }
}

From source file:Main.java

public static void sendSchemeForResult(Activity activity, String url, int requestCode, Bundle bundle,
        int flag) {
    Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
    if (bundle != null) {
        intent.putExtras(bundle);//from ww w . j a  va  2s .co m
    }

    if (flag != 0) {
        intent.setFlags(flag);
    }

    activity.startActivityForResult(intent, requestCode);
}

From source file:com.frostwire.android.gui.StoragePicker.java

public static void show(Activity activity) {
    Intent intent = new Intent(ACTION_OPEN_DOCUMENT_TREE);
    intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
    intent.putExtra(EXTRA_SHOW_ADVANCED, true);
    activity.startActivityForResult(intent, SELECT_FOLDER_REQUEST_CODE);
}

From source file:com.mvc.imagepicker.ImagePicker.java

/**
 * Launch a dialog to pick an image from camera/gallery apps.
 *
 * @param activity     which will launch the dialog.
 * @param chooserTitle will appear on the picker dialog.
 *//*from   w w w. j a v a 2s. c  o m*/
public static void pickImage(Activity activity, String chooserTitle) {
    Intent chooseImageIntent = getPickImageIntent(activity, chooserTitle);
    activity.startActivityForResult(chooseImageIntent, PICK_IMAGE_REQUEST_CODE);
}

From source file:Main.java

private static void intentPick(String action, Activity activity, int requestCode, String title,
        String[] filter) {//from w  w w  . j  a  va 2  s.c o  m
    Intent intent = new Intent(action);
    if (title != null && title.length() > 0)
        intent.putExtra("org.openintents.extra.TITLE", title);
    if (filter != null && filter.length > 0)
        intent.putExtra("org.openintents.extra.FILTER", filter);
    activity.startActivityForResult(intent, requestCode);
}

From source file:foam.jellyfish.ActivityManager.java

static public void StartActivity(Activity src, String name, int requestcode, String arg) {
    Class ActClass = m_Activities.get(name);
    if (ActClass == null) {
        Log.i("starwisp", "activity " + name + " not found in registry");
    } else {/*from   ww  w . j a  v a 2s .  co  m*/
        Intent intent = new Intent(src, ActClass);
        intent.putExtra("arg", arg);
        src.startActivityForResult(intent, requestcode);
    }
}