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:br.com.brolam.cloudvision.ui.NoteVisionActivity.java

/**
 * Atualizar um NoteVision e seu contedo(item)
 * @param activity informar uma atividade vlida
 * @param requestCod informar o cdigo de requisio da atividade {@see Activity.onActivityResult}
 * @param noteVisionKey informar um chave vlida.
 * @param noteVisionItemKey informar um chave vlida.
 * @param title informar o ttulo do NoteVision
 * @param content informar o contedo do item do Notevision
 * @param onKeyboard informar se o teclado deve ser ativiado em vez da camera.
 *///from   w w w  .j a  v  a 2s.c o  m
public static void updateNoteVision(Activity activity, int requestCod, String noteVisionKey,
        String noteVisionItemKey, String title, String content, Boolean onKeyboard) {
    Intent intent = new Intent(activity, NoteVisionActivity.class);
    intent.putExtra(NOTE_VISION_KEY, noteVisionKey);
    intent.putExtra(NOTE_VISION_ITEM_KEY, noteVisionItemKey);
    intent.putExtra(NoteVision.TITLE, title);
    intent.putExtra(NoteVisionItem.CONTENT, content);
    intent.putExtra(ON_KEYBOARD, onKeyboard);
    activity.startActivityForResult(intent, requestCod);

}

From source file:com.liferay.mobile.screens.viewsets.defaultviews.ddl.form.fields.DDLDocumentFieldView.java

@NonNull
private Action1<Boolean> launchCamera(final String intent) {
    return new Action1<Boolean>() {
        @Override/*w  w w . j  av a 2s. c  o m*/
        public void call(Boolean result) {
            if (result) {
                Intent cameraIntent = new Intent(intent);
                File file = MediaStore.ACTION_VIDEO_CAPTURE.equals(intent) ? FileUtil.createVideoFile()
                        : FileUtil.createImageFile();

                if (file != null) {
                    getField().createLocalFile(file.getAbsolutePath());
                    Uri photoURI = FileProvider.getUriForFile(getContext(),
                            getContext().getPackageName() + ".screensfileprovider", file);
                    cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);

                    Activity activity = LiferayScreensContext.getActivityFromContext(getContext());
                    activity.startActivityForResult(cameraIntent, positionInForm);
                }
            }
            choseOriginDialog.dismiss();
        }
    };
}

From source file:com.simplaapliko.trips.presentation.navigation.Navigator.java

public void navigateToAddTrip(Activity activity) {
    if (activity != null) {
        Intent intentToLaunch = EditTripActivity.getCallingIntent(activity);
        activity.startActivityForResult(intentToLaunch, EventType.CREATE_TRIP);
    }/*ww w  . jav  a2 s . c o  m*/
}

From source file:com.simplaapliko.trips.presentation.navigation.Navigator.java

public void navigateToTrip(Activity activity, long tripId) {
    if (activity != null) {
        Intent intentToLaunch = TripActivity.getCallingIntent(activity, tripId);
        activity.startActivityForResult(intentToLaunch, EventType.VIEW_TRIP);
    }//from   www. j ava 2s. c  o  m
}

From source file:com.simplaapliko.trips.presentation.navigation.Navigator.java

public void navigateToEditTrip(Activity activity, long tripId) {
    if (activity != null) {
        Intent intentToLaunch = EditTripActivity.getCallingIntent(activity, tripId);
        activity.startActivityForResult(intentToLaunch, EventType.EDIT_TRIP);
    }//w w  w .j a  v  a  2 s  . c  om
}

From source file:com.simplaapliko.trips.presentation.navigation.Navigator.java

public void navigateToAddPlace(Activity activity, long tripId) {
    if (activity != null) {
        Intent intentToLaunch = EditPlaceActivity.getAddCallingIntent(activity, tripId);
        activity.startActivityForResult(intentToLaunch, EventType.CREATE_PLACE);
    }/*from   w  w w.ja  v  a 2  s .c  o m*/
}

From source file:com.simplaapliko.trips.presentation.navigation.Navigator.java

public void navigateToEditPlace(Activity activity, long placeId, long tripId) {
    if (activity != null) {
        Intent intentToLaunch = EditPlaceActivity.getEditCallingIntent(activity, placeId, tripId);
        activity.startActivityForResult(intentToLaunch, EventType.EDIT_PLACE);
    }/*from   w  w  w. j  a  va 2 s.  co  m*/
}

From source file:de.petendi.ethereum.android.EthereumAndroid.java

public void submitTransaction(Activity parentActivity, int requestCode, String transactionString) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setPackage(EthereumAndroidFactory.PACKAGENAME);
    intent.setData(Uri.parse("eth:" + transactionString));
    parentActivity.startActivityForResult(intent, requestCode);
}

From source file:de.petendi.ethereum.android.EthereumAndroid.java

public void requestSignature(Activity parentActivity, int requestCode, String hexEncodedMessage) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setPackage(EthereumAndroidFactory.PACKAGENAME);
    intent.setData(Uri.parse("eth:sign/" + hexEncodedMessage));
    parentActivity.startActivityForResult(intent, requestCode);
}

From source file:com.alivenet.dmv.driverapplication.fragment.MyAccount.java

public static void takePicture(final Activity context) {

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    try {/*from   w w  w  .  j  ava2  s. co  m*/
        Uri mImageCaptureUri = null;
        String state = Environment.getExternalStorageState();
        if (Environment.MEDIA_MOUNTED.equals(state)) {
            mImageCaptureUri = Uri.fromFile(AppData.getSingletonObject().getmFileTemp());
        } else {

            mImageCaptureUri = InternalStorageContentProvider.CONTENT_URI;
        }
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
        intent.putExtra("return-data", true);
        context.startActivityForResult(intent, ConstantUtil.REQUEST_CODE_TAKE_PICTURE);
    } catch (ActivityNotFoundException e) {

        Log.d(ConstantUtil.BLANK_TEXT, "cannot take picture", e);
    }

}