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:io.hypertrack.sendeta.util.images.EasyImage.java

public static void openChooser(Activity activity, String chooserTitle, boolean showGallery) {
    try {//ww w.  j av  a  2  s. co  m
        Intent intent = createChooserIntent(activity, chooserTitle, showGallery);
        activity.startActivityForResult(intent, REQ_SOURCE_CHOOSER);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:eu.siacs.conversations.ui.ScanActivity.java

public static void scan(Activity activity) {
    if (ContextCompat.checkSelfPermission(activity,
            Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
        Intent intent = new Intent(activity, ScanActivity.class);
        activity.startActivityForResult(intent, REQUEST_SCAN_QR_CODE);
    } else {//from www.  ja va  2s .com
        ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.CAMERA },
                REQUEST_CAMERA_PERMISSIONS_TO_SCAN);
    }

}

From source file:de.pixart.messenger.ui.ScanActivity.java

public static void scan(Activity activity) {
    if (ContextCompat.checkSelfPermission(activity,
            Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
        Intent intent = new Intent(activity, ScanActivity.class);
        activity.startActivityForResult(intent, REQUEST_SCAN_QR_CODE);
        activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
    } else {/*from   w w  w  .  ja v  a  2  s  .c om*/
        ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.CAMERA },
                REQUEST_CAMERA_PERMISSIONS_TO_SCAN);
    }

}

From source file:me.fireant.photoselect.ui.PhotoSelectedPreviewActivity.java

public static void luanch(Activity activity, ArrayList<Photo> selectedPhotos, int selectIndex,
        int requsetCode) {
    Intent intent = new Intent(activity, PhotoSelectedPreviewActivity.class);
    intent.putParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS, selectedPhotos);
    intent.putExtra(BUNDLE_SELECT_INDEX, selectIndex);
    activity.startActivityForResult(intent, requsetCode);
}

From source file:br.com.brolam.cloudvision.ui.NoteVisionDetailsActivity.java

/**
 * Acionar a exibio dos detalhes de um Note Vision.
 * @param activity      informar a atividade que receber o retorno.
 * @param requestCod    informar o cdigo de requisio dessa atividade.
 * @param noteVisionKey informar uma chave vlida.
 * @param noteVision    informar um NoteVision vlido.
 *//*from   ww w.  ja  va2  s  .  c  o m*/
public static void show(Activity activity, int requestCod, String noteVisionKey, HashMap noteVision) {
    Intent intent = getIntent(activity, noteVisionKey, noteVision);
    activity.startActivityForResult(intent, requestCod);
}

From source file:Main.java

public static void getCameraFromSelfCenter(Activity activity, boolean openFrontCamera) {
    initData(activity);//from  w  w w .j a  va 2s . c  o m
    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
    Intent intent_camera = activity.getPackageManager().getLaunchIntentForPackage("com.android.camera");
    if (intent_camera != null) {
        intent.setPackage("com.android.camera");
    }
    if (openFrontCamera) {
        intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
    }
    intent.putExtra(MediaStore.EXTRA_OUTPUT, mAvatarUri);
    activity.startActivityForResult(intent, REQUEST_TAKE_PICTURE_SELF_CENTER);
}

From source file:com.github.kanata3249.ffxieq.android.VWAtmaLevelSelectorActivity.java

static public boolean startActivity(Activity from, int request, long current, long subId) {
    Intent intent = new Intent(from, VWAtmaLevelSelectorActivity.class);

    intent.putExtra("Current", current);
    intent.putExtra("SubId", subId);
    intent.putExtra("Filter", (long) -1);

    from.startActivityForResult(intent, request);
    return true;//from  ww  w  .  j a va  2  s  . c o m
}

From source file:us.rader.tapset.ItemListActivity.java

/**
 * Launch a {@link WriteTagActivity}/*from w  w  w  .  j a  va  2 s .  c  om*/
 * 
 * @param context
 *            the {@link Activity} on whose behalf to launch a
 *            {@link WriteTagActivity}
 * 
 * @return <code>true</code>
 */
public static boolean writeTag(Activity context) {

    Intent intent = new Intent("us.rader.tapset.writetag", //$NON-NLS-1$
            Item.createUri(context), context, WriteTagActivity.class);
    context.startActivityForResult(intent, REQUEST_CODE_WRITE_TAG);
    return true;

}

From source file:com.github.kanata3249.ffxieq.android.AtmaSelector.java

static public boolean startActivity(Activity from, int request, FFXICharacter charInfo, int index,
        long current) {
    Intent intent = new Intent(from, AtmaSelector.class);

    intent.putExtra("Current", current);
    intent.putExtra("Index", index);
    intent.putExtra("Filter", (long) -1);

    from.startActivityForResult(intent, request);
    return true;/*from  w ww . j a v  a  2  s .c om*/
}

From source file:com.cerema.cloud2.ui.activity.UploadFilesActivity.java

/**
 * Helper to launch the UploadFilesActivity for which you would like a result when it finished.
 * Your onActivityResult() method will be called with the given requestCode.
 *
 * @param activity    the activity which should call the upload activity for a result
 * @param account     the account for which the upload activity is called
 * @param requestCode If >= 0, this code will be returned in onActivityResult()
 *///from   w  w  w  . ja  v  a 2s.co  m
public static void startUploadActivityForResult(Activity activity, Account account, int requestCode) {
    Intent action = new Intent(activity, UploadFilesActivity.class);
    action.putExtra(EXTRA_ACCOUNT, (account));
    activity.startActivityForResult(action, requestCode);
}