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 startActivityForResult(Activity context, Class<?> cls, String data, int flag) {
    Intent intent = new Intent(context, cls);
    intent.putExtra("data", data);
    intent.setFlags(flag);/*from w  ww .  ja v  a2s.c  o  m*/
    context.startActivityForResult(intent, flag);
}

From source file:Main.java

public static void chooseImg(Activity activity) {
    Intent pickIntent = new Intent(Intent.ACTION_PICK, null);
    pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
    activity.startActivityForResult(pickIntent, PHOTO_REQUEST_GALLERY);
}

From source file:Main.java

public static void startActivityForResult(Activity activity, Class<?> cls, String data, int flag) {
    Intent intent = new Intent(activity, cls);
    intent.putExtra("data", data);
    intent.setFlags(flag);//from  www.j  a  v a2s.  c om
    activity.startActivityForResult(intent, flag);
}

From source file:Main.java

public static void requestHiddenServiceOnPort(Activity activity, int port) {
    Intent intent = new Intent(ACTION_REQUEST_HS);
    intent.setPackage(ORBOT_PACKAGE_NAME);
    intent.putExtra("hs_port", port);

    activity.startActivityForResult(intent, HS_REQUEST_CODE);
}

From source file:Main.java

public static void chooseVideoFromExternal(Activity activity, int requestCode) {
    Intent choosePictureIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(choosePictureIntent, requestCode);
}

From source file:Main.java

public static void chooseMediaFromExternal(Activity activity, int requestCode) {
    Intent choosePictureIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(choosePictureIntent, requestCode);
}

From source file:Main.java

public static void choosePictureFromExternal(Activity activity, int requestCode) {
    Intent choosePictureIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(choosePictureIntent, requestCode);
}

From source file:Main.java

public static void pickImageFromAlbum2(final Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_PICK);
    intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

From source file:com.andryr.musicplayer.utils.NavigationUtils.java

public static void showSearchActivity(Activity activity, int requestCode) {
    Intent i = new Intent(activity, SearchActivity.class);
    activity.startActivityForResult(i, requestCode);
}

From source file:Main.java

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