Example usage for android.support.v4.app FragmentActivity startActivityForResult

List of usage examples for android.support.v4.app FragmentActivity startActivityForResult

Introduction

In this page you can find the example usage for android.support.v4.app FragmentActivity startActivityForResult.

Prototype

@Override
public void startActivityForResult(Intent intent, int requestCode) 

Source Link

Document

Modifies the standard behavior to allow results to be delivered to fragments.

Usage

From source file:th.in.ffc.person.PersonActivity.java

public static void startPersonActivityForResult(FragmentActivity activity, Intent intent, int requestCode,
        String pid, String pcucodeperson) {
    intent.setData(Uri.withAppendedPath(Person.CONTENT_URI, pid));
    intent.putExtra(PersonColumns._PCUCODEPERSON, pcucodeperson);
    activity.startActivityForResult(intent, requestCode);
}

From source file:com.javielinux.utils.UserActions.java

public static void goToIncludeListSelection(FragmentActivity activity) {
    Intent intent = new Intent(activity, UserListsSelectorActivity.class);
    activity.startActivityForResult(intent, UserActivity.ACTIVITY_INCLUDE_IN_LIST);
}

From source file:org.totschnig.myexpenses.activity.CommonCommands.java

public static void showContribInfoDialog(FragmentActivity ctx, long sequenceCount) {
    Intent i = new Intent(ctx, ContribInfoDialogActivity.class);
    i.putExtra(ContribInfoDialogFragment.KEY_SEQUENCE_COUNT, sequenceCount);
    ctx.startActivityForResult(i, 0);
}

From source file:org.alfresco.mobile.android.application.security.PassCodeActivity.java

public static void requestUserPasscode(FragmentActivity activity) {
    PasscodeConfigFeature feature = new PasscodeConfigFeature(activity);
    if (feature.isProtected() && !PasscodePreferences.hasPasscode(activity)) {
        Intent i = new Intent(activity, PassCodeActivity.class);
        i.setAction(REQUEST_DEFINE_PASSCODE);
        activity.startActivityForResult(i, REQUEST_CODE_PASSCODE);
    } else if (PasscodePreferences.hasPasscodeEnable(activity)) {
        activity.startActivityForResult(new Intent(activity, PassCodeActivity.class), REQUEST_CODE_PASSCODE);
    }//from  w  ww  . j  a v  a2 s  .co m
}

From source file:org.adaway.helper.ImportExportHelper.java

/**
 * Opens file manager to open file and return it in onActivityResult in Activity
 *
 * @param activity/*from w  w w  . j a  v a 2s  .  c om*/
 */
public static void openFileStream(final FragmentActivity activity) {
    final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("text/plain");
    intent.addCategory(Intent.CATEGORY_OPENABLE);

    try {
        activity.startActivityForResult(intent, REQUEST_CODE_IMPORT);
    } catch (ActivityNotFoundException e) {
        ActivityNotFoundDialogFragment notFoundDialog = ActivityNotFoundDialogFragment.newInstance(
                R.string.no_file_manager_title, R.string.no_file_manager,
                "market://details?id=org.openintents.filemanager", "OI File Manager");

        notFoundDialog.show(activity.getSupportFragmentManager(), "notFoundDialog");
    }
}

From source file:org.alfresco.mobile.android.application.fragments.menu.MainMenuFragment.java

public static void displayPreferences(FragmentActivity context, Long accountId) {
    if (DisplayUtils.hasCentralPane(context)) {
        Intent i = new Intent(PrivateIntent.ACTION_DISPLAY_SETTINGS);
        i.putExtra(PrivateIntent.EXTRA_ACCOUNT_ID, accountId);
        context.startActivityForResult(i, RequestCode.SETTINGS);
    } else {//from   w w  w . j  a v  a2s.  co m
        GeneralPreferences.with(context).display();
    }
}

From source file:disono.webmons.com.utilities.sensor.Camera.Launcher.java

public void takePicture(FragmentActivity fragmentActivity) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    if (intent.resolveActivity(mActivity.getApplicationContext().getPackageManager()) != null) {
        fragmentActivity.startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
    }//w ww  .  j a  v a 2 s .c  o  m
}

From source file:com.jefftharris.passwdsafe.sync.gdrive.GDriveProvider.java

@Override
public void startAccountLink(FragmentActivity activity, int requestCode) {
    Intent intent = AccountPicker.newChooseAccountIntent(null, null,
            new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE }, true, null, null, null, null);
    try {/*  ww  w  .ja  v  a2s  . com*/
        activity.startActivityForResult(intent, requestCode);
    } catch (ActivityNotFoundException e) {
        String msg = itsContext.getString(R.string.google_acct_not_available);
        Log.e(TAG, msg, e);
        PasswdSafeUtil.showErrorMsg(msg, activity);
    }
}

From source file:org.alfresco.mobile.android.application.managers.DataProtectionManagerImpl.java

public void executeAction(FragmentActivity activity, int intentAction, File f) {
    try {//  w  w w. j  a  v  a 2 s.  c o  m
        if (intentAction == DataProtectionManager.ACTION_NONE || intentAction == 0) {
            return;
        }
        Intent i = createActionIntent(activity, intentAction, f);
        if (i.resolveActivity(activity.getPackageManager()) == null) {
            AlfrescoNotificationManager.getInstance(activity).showAlertCrouton(activity,
                    activity.getString(R.string.feature_disable));
        } else {
            activity.startActivityForResult(i, PrivateRequestCode.DECRYPTED);
        }
    } catch (ActivityNotFoundException e) {

    }
}

From source file:Utils.GenericUtils.java

public final AlertDialog initiateScan(FragmentActivity fa, Collection<String> desiredBarcodeFormats) {
    Intent intentScan = new Intent("com.google.zxing.client.android.SCAN");

    intentScan.addCategory(Intent.CATEGORY_DEFAULT);
    intentScan.putExtra("SCAN_FORMATS", "QR_CODE_MODE");
    fa.startActivityForResult(intentScan, 312 /*IntentIntegrator.REQUEST_CODE*/);

    String targetAppPackage = "ET - QRCODE SCANNER";
    intentScan.setPackage(targetAppPackage);
    intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    return null;//from w w  w  .j ava2s. co m
}