当前位置: 首页>>代码示例>>Java>>正文


Java Fragment.startActivityForResult方法代码示例

本文整理汇总了Java中android.support.v4.app.Fragment.startActivityForResult方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.startActivityForResult方法的具体用法?Java Fragment.startActivityForResult怎么用?Java Fragment.startActivityForResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.Fragment的用法示例。


在下文中一共展示了Fragment.startActivityForResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchForResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void launchForResult(Fragment fragment, ArrayList<BeautyPhotoInfo> datas, int index) {
    Intent intent = new Intent(fragment.getContext(), BigPhotoActivity.class);
    intent.putParcelableArrayListExtra(BIG_PHOTO_KEY, datas);
    intent.putExtra(PHOTO_INDEX_KEY, index);
    intent.putExtra(FROM_LOVE_ACTIVITY, true);
    fragment.startActivityForResult(intent, CommonConstant.REQUEST_CODE);
    fragment.getActivity().overridePendingTransition(R.anim.expand_vertical_entry, R.anim.hold);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:BigPhotoActivity.java

示例2: go

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void go(Fragment fragment) {
    FragmentActivity activity = fragment.getActivity();
    Context context = fragment.getContext();
    Intent intent = getIntent(activity != null ? activity : context);
    if (intent == null) {
        return;
    }
    Bundle options = mRouteRequest.getActivityOptionsCompat() == null ?
            null : mRouteRequest.getActivityOptionsCompat().toBundle();

    if (mRouteRequest.getRequestCode() < 0) {
        fragment.startActivity(intent, options);
    } else {
        fragment.startActivityForResult(intent, mRouteRequest.getRequestCode(), options);
    }
    if (activity != null && mRouteRequest.getEnterAnim() != 0 && mRouteRequest.getExitAnim() != 0) {
        // Add transition animation.
        activity.overridePendingTransition(
                mRouteRequest.getEnterAnim(), mRouteRequest.getExitAnim());
    }

    callback(RouteResult.SUCCEED, null);
}
 
开发者ID:chenenyu,项目名称:Router,代码行数:25,代码来源:RealRouter.java

示例3: retrieveInputFromUser

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void retrieveInputFromUser(Fragment fragment) {
    ensurePermission(fragment);

    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
            fragment.getString(R.string.speech_prompt));
    try {
        fragment.startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
    } catch (ActivityNotFoundException a) {
        setFailureMessage(fragment.getString(R.string.speech_not_supported));
    }
}
 
开发者ID:Captwalloper,项目名称:NUI_Project,代码行数:17,代码来源:VoiceListener.java

示例4: forResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Start to select media and wait for result.
 *
 * @param requestCode Identity of the request Activity or Fragment.
 */
public void forResult(int requestCode) {
    Activity activity = mMatisse.getActivity();
    if (activity == null) {
        return;
    }

    Intent intent = new Intent(activity, MatisseActivity.class);

    Fragment fragment = mMatisse.getFragment();
    if (fragment != null) {
        fragment.startActivityForResult(intent, requestCode);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
}
 
开发者ID:sathishmscict,项目名称:Matisse-Image-and-Video-Selector,代码行数:21,代码来源:SelectionCreator.java

示例5: startActivityForResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void startActivityForResult(Activity activity, Fragment fragment, final Intent intent, final int reqCodeCamera) throws ActivityNotFoundException {
    if (fragment == null) {
        activity.startActivityForResult(intent, reqCodeCamera);
    } else {
        fragment.startActivityForResult(intent, reqCodeCamera);
    }
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:8,代码来源:CameraPickerHelper.java

示例6: openChooser

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void openChooser(Fragment fragment, String chooserTitle) {
    try {
        Intent intent = createChooserIntent(fragment.getActivity(), chooserTitle);
        fragment.startActivityForResult(intent, REQ_SOURCE_CHOOSER);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:hypertrack,项目名称:hypertrack-live-android,代码行数:9,代码来源:EasyImage.java

示例7: openAlbums

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 通过打开相册
 */
public void openAlbums(Fragment fragment, int currentSelectPhotoMaxCount) {
    if (fragment == null) {
        return;
    }
    Context context = fragment.getContext();
    PhotoPickerIntent pickIntent = new PhotoPickerIntent(context);
    pickIntent.setSelectModel(SelectModel.MULTI);
    pickIntent.setShowCarema(true); // 是否显示拍照
    pickIntent.setMaxTotal(currentSelectPhotoMaxCount); // 最多选择照片数量
    fragment.startActivityForResult(pickIntent, mRequestCode);
}
 
开发者ID:Sugarya,项目名称:SugarPhotoPicker,代码行数:15,代码来源:SelectPhotoRecyclerView.java

示例8: startChooseSpeciesActivity

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void startChooseSpeciesActivity(FragmentActivity activity, Fragment fragment,
                                              int category, ArrayList<Species> species, boolean showOther) {
    Intent intent = new Intent(activity, ChooseSpeciesActivity.class);
    intent.putExtra(ChooseSpeciesActivity.EXTRA_SPECIES_CATEGORY, category);
    intent.putExtra(ChooseSpeciesActivity.EXTRA_SPECIES_LIST, species);
    intent.putExtra(ChooseSpeciesActivity.EXTRA_SHOW_OTHER, showOther);

    if (fragment != null) {
        fragment.startActivityForResult(intent, ChooseSpeciesActivity.SPECIES_REQUEST_CODE);
    } else {
        activity.startActivityForResult(intent, ChooseSpeciesActivity.SPECIES_REQUEST_CODE);
    }
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:14,代码来源:UiUtils.java

示例9: openAlbums

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * 打开图库
 */
public static void openAlbums(Fragment context) {
    //打开系统图库程序
    Intent intentGallery = new Intent();
    intentGallery.setType("image/*");
    intentGallery.setAction(Intent.ACTION_PICK);
    context.startActivityForResult(intentGallery, REQUEST_CODE_GALLERY);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:11,代码来源:PicturePickupTool.java

示例10: cropImage

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void cropImage(Fragment fragment, Uri srcUri) {
    cropImageUri = createImagePathUri(fragment.getContext());

    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(srcUri, "image/*");
    intent.putExtra("crop", "true");

    ////////////////////////////////////////////////////////////////
    // 1.宽高和比例都不设置时,裁剪框可以自行调整(比例和大小都可以随意调整)
    ////////////////////////////////////////////////////////////////
    // 2.只设置裁剪框宽高比(aspect)后,裁剪框比例固定不可调整,只能调整大小
    ////////////////////////////////////////////////////////////////
    // 3.裁剪后生成图片宽高(output)的设置和裁剪框无关,只决定最终生成图片大小
    ////////////////////////////////////////////////////////////////
    // 4.裁剪框宽高比例(aspect)可以和裁剪后生成图片比例(output)不同,此时,
    //	会以裁剪框的宽为准,按照裁剪宽高比例生成一个图片,该图和框选部分可能不同,
    //  不同的情况可能是截取框选的一部分,也可能超出框选部分,向下延伸补足
    ////////////////////////////////////////////////////////////////

    // aspectX aspectY 是裁剪框宽高的比例
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    // outputX outputY 是裁剪后生成图片的宽高
    intent.putExtra("outputX", 300);
    intent.putExtra("outputY", 300);

    // return-data为true时,会直接返回bitmap数据,但是大图裁剪时会出现问题,推荐下面为false时的方式
    // return-data为false时,不会返回bitmap,但需要指定一个MediaStore.EXTRA_OUTPUT保存图片uri
    intent.putExtra(MediaStore.EXTRA_OUTPUT, cropImageUri);
    intent.putExtra("return-data", true);

    fragment.startActivityForResult(intent, CROP_IMAGE);
}
 
开发者ID:ChunweiDu,项目名称:Utils,代码行数:34,代码来源:PhotoUtil.java

示例11: startFriendsSelection

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void startFriendsSelection(@NonNull Fragment fragment, int requestCode) {
    int aid = Settings.get()
            .accounts()
            .getCurrent();

    Place place = PlaceFactory.getFriendsFollowersPlace(aid, aid, FriendsTabsFragment.TAB_ALL_FRIENDS, null);

    SelectProfileCriteria criteria = new SelectProfileCriteria().setFriendsOnly(true);

    Intent intent = new Intent(fragment.getActivity(), SelectProfilesActivity.class);
    intent.setAction(SelectProfilesActivity.ACTION_OPEN_PLACE);
    intent.putExtra(Extra.PLACE, place);
    intent.putExtra(Extra.CRITERIA, criteria);
    fragment.startActivityForResult(intent, requestCode);
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:16,代码来源:SelectProfilesActivity.java

示例12: launchForResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void launchForResult(Fragment fragment, VideoInfo data) {
    Intent intent = new Intent(fragment.getContext(), VideoPlayerActivity.class);
    intent.putExtra(VIDEO_DATA_KEY, data);
    fragment.startActivityForResult(intent, CommonConstant.VIDEO_REQUEST_CODE);
    fragment.getActivity().overridePendingTransition(R.anim.slide_bottom_entry, R.anim.hold);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:VideoPlayerActivity.java

示例13: start

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * same as {@link Fragment#startActivityForResult(Intent, int, Bundle)}
 */
public void start(@NonNull Fragment fragment, int requestCode) {
    fragment.startActivityForResult(mIntent, requestCode);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:Boxing.java

示例14: startImagePicker

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void startImagePicker(Fragment fragment) {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType(MimeType.IMAGE_MIME);
    fragment.startActivityForResult(Intent.createChooser(intent, fragment.getString(R.string.dlg_choose_image_from)), GALLERY_REQUEST_CODE);
}
 
开发者ID:mobilemaster128,项目名称:quickblox-android,代码行数:6,代码来源:ImageUtils.java

示例15: forResult

import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
 * Start to select media and wait for result.
 *
 * @param requestCode Identity of the request Activity or Fragment.
 */
public void forResult(int requestCode) {
    Activity activity = vanGogh.getActivity();
    if (activity == null) {
        return;
    }

    if (cropEnable) {
        vanConfig.countable = false;
        vanConfig.maxCount = 1;
    } else {
        vanConfig.countable = countable;
        vanConfig.maxCount = maxCount;
    }
    if (mVanMediaFilters != null && mVanMediaFilters.size() > 0) {
        vanConfig.vanMediaFilters = mVanMediaFilters;
    }

    vanConfig.vanMediaTypeSet = mVanMediaType;
    vanConfig.themeID = themeID;
    vanConfig.orientation = mOrientation;

    vanConfig.cameraVisible = cameraVisible;
    vanConfig.packageName = packageName;

    vanConfig.spanCount = rowCount;
    vanConfig.cropEnable = cropEnable;
    vanConfig.cropWidth = cropWidth;
    vanConfig.cropHeight = cropHeight;
    vanConfig.cropType = cropType;

    vanConfig.thumbnailScale = thumbnailScale;
    vanConfig.imageLoader = imageLoader;
    vanConfig.toastListener = toastListener;

    Intent intent = new Intent(activity, VanMediaActivity.class);
    Fragment fragment = vanGogh.getFragment();
    if (fragment != null) {
        fragment.startActivityForResult(intent, requestCode);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:48,代码来源:VanGoghBuilder.java


注:本文中的android.support.v4.app.Fragment.startActivityForResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。