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 pickPhoto(Activity activity, int resultCode) {
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    activity.startActivityForResult(intent, resultCode);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:com.stfalcon.socialauthhelper.vk.utils.VkUtilities.java

public static void openAuthorizationActivity(Activity activity, int requestCode) {
    Intent authIntent = getAuthIntent(activity);
    activity.startActivityForResult(authIntent, requestCode);
}

From source file:Main.java

public static void takePhotoFromAbnum(Activity activity) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    intent.setType("image/*");
    activity.startActivityForResult(intent, TAKE_PHOTO_FROM_ALBUM);
}

From source file:Main.java

public static boolean startForwardActivity(Activity activity) {
    try {/* w w  w  .  ja va  2  s. co  m*/
        Intent i = activity.getIntent().getParcelableExtra(EXTRA_FORWARD_INTENT);
        if (i != null) {
            activity.startActivityForResult(i, 0);
            return true;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

From source file:Main.java

public static void toTakePicture(int requestcode, Activity activity) {
    Intent intent = new Intent(Intent.ACTION_PICK, null);
    intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
    activity.startActivityForResult(intent, requestcode);
}

From source file:Main.java

public static boolean startActivityForResult(Activity activity, Intent intent, int requestCode) {
    if (activity == null || intent == null) {
        return false;
    }/*from  w w  w. j av  a2  s  .  co  m*/

    try {
        activity.startActivityForResult(intent, requestCode);
    } catch (Exception globalException) {
        globalException.printStackTrace();
        return false;
    }
    return true;
}

From source file:Main.java

public static void takePhoto(Activity activity, int requestCode, Uri uri) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void turnPhotosWithCrop(Activity mContext, int requestCode) {
    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setType("image/*");
    intent.putExtra("return-data", true);
    mContext.startActivityForResult(intent, requestCode);
}