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.yanzhenjie.album.Album.java

/**
 * @param activity    ?Activity/* ww  w  .  java 2  s  .  c o  m*/
 * @param requestCode ?
 */
public static void startAlbum(Activity activity, int requestCode) {
    Intent intent = new Intent(activity, AlbumActivity.class);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void showPhoneContact(Activity activity, int returnCode) {
    if (activity == null)
        return;//  w w  w  .ja  v a  2  s.  co m

    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
    activity.startActivityForResult(intent, returnCode);
}

From source file:Main.java

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

From source file:Main.java

static void fireScreenCaptureIntent(Activity activity) {
    MediaProjectionManager manager = (MediaProjectionManager) activity
            .getSystemService(MEDIA_PROJECTION_SERVICE);
    Intent intent = manager.createScreenCaptureIntent();
    activity.startActivityForResult(intent, CREATE_SCREEN_CAPTURE);
}

From source file:com.facebook.internal.DialogPresenter.java

public static void present(AppCall appCall, Activity activity) {
    activity.startActivityForResult(appCall.getRequestIntent(), appCall.getRequestCode());

    appCall.setPending();//w w  w  .  jav a2 s  . co m
}

From source file:Main.java

static void fireScreenCaptureIntent(Activity activity) {
    MediaProjectionManager manager = (MediaProjectionManager) activity
            .getSystemService(Context.MEDIA_PROJECTION_SERVICE);
    Intent intent = manager.createScreenCaptureIntent();
    activity.startActivityForResult(intent, CREATE_SCREENSHOT);
    Log.i("TakeScreenshotService", "fireScreenCaptureIntent...");
}

From source file:Main.java

public static void startCamera(Activity activity, int requestCode, File outPath) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    Uri uri = Uri.fromFile(outPath);/*  w  w  w .  j  a v  a  2s .  co  m*/
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        int extraValue) {
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}

From source file:com.xiaodu.permission.util2.ESPermission.java

private static void startAppSettingsScreen(Activity pActivity, Intent intent) {
    pActivity.startActivityForResult(intent, SETTINGS_REQ_CODE);
}

From source file:Main.java

public static void goPageForResult(Activity context, int requstcode, Class<?> gopage, String extraName,
        String extraValue) {/*  w  w  w.  j ava 2  s .  co  m*/
    Intent intent = new Intent(context, gopage);
    intent.putExtra(extraName, extraValue);
    context.startActivityForResult(intent, requstcode);
}