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:Main.java

public static void jumpActivityForResult(Activity context, Class<? extends Activity> activityClass,
        int requestCode) {
    Intent intent = new Intent(context, activityClass);
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void goActivityForResultWithBundle(Activity activity, Class clazz, Bundle bundle, int requestID) {
    Intent intent = new Intent(activity, clazz);
    intent.putExtras(bundle);// w  w w. j a  va2s .  c om
    activity.startActivityForResult(intent, requestID);
}

From source file:Main.java

public static boolean pickFile(Activity activity, int requestCode) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("file/*");
    activity.startActivityForResult(intent, requestCode);
    return true;//from  w  w  w .j a  v a  2 s.  c o m
}

From source file:Main.java

public static void startActivityForResult(Activity activity, Class class1, Bundle bundle, int i) {
    Intent intent = new Intent(activity, class1);
    intent.putExtras(bundle);//from   www . ja va  2 s  .  co  m
    activity.startActivityForResult(intent, i);
}

From source file:Main.java

public static void takeVideo(Activity ac) {

    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

    ac.startActivityForResult(intent, TAKE_VIDEO);
}

From source file:Main.java

public static void choosePicture(Activity activity, int requestCode) {
    Intent openAlbumIntent = new Intent(Intent.ACTION_GET_CONTENT);
    openAlbumIntent.setType("image/*");
    activity.startActivityForResult(openAlbumIntent, requestCode);
}

From source file:Main.java

public static void FindPhoto(Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");

    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:Main.java

public static void pickImageFromAlbum(final Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:eu.geopaparazzi.library.sketch.SketchUtilities.java

/**
 * Opens Marker in new sketch mode, supplying a file to save to.
 * <p/>/*from   www  .  ja  v a2  s . c  o m*/
 * <p>If position data are supplied, they should be used to create a properties file.
 *
 * @param context     the context to use.
 * @param image       the image file to save to.
 * @param gpsLocation the position of the sketch or <code>null</code>.
 * @param requestCode if > 0, then the activity is started for a result (in which case the
 *                    Context needs to be an activity..
 */
public static void launch(Context context, File image, double[] gpsLocation, int requestCode) {
    Intent sketchIntent = prepareIntent(context, image, gpsLocation);
    if (requestCode < 0) {
        context.startActivity(sketchIntent);
    } else {
        if (context instanceof Activity) {
            Activity activity = (Activity) context;
            activity.startActivityForResult(sketchIntent, requestCode);
        }
    }
}

From source file:Main.java

public static void startSelectLocalPhotoActivity(Activity activity, int requestCode) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    activity.startActivityForResult(intent, requestCode);
}