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


Java Activity.startActivityForResult方法代码示例

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


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

示例1: photoCapture

import android.app.Activity; //导入方法依赖的package包/类
public static Uri photoCapture(Activity activity, int requstCode) {
    Uri mCaptureUri = null;
    if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
        try {
            mCaptureUri = Uri.fromFile(new File(getFileDir(), "pic_" + String.valueOf(System.currentTimeMillis()) +
                    ".jpg"));
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, mCaptureUri);
            intent.putExtra("return-data", true);
            activity.startActivityForResult(intent, requstCode);
            // IntentUtil.openActivityAnim(SubmitActivity.this);
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    } else {
        Toast.makeText(activity, "请插入SD卡", Toast.LENGTH_SHORT).show();
    }
    return mCaptureUri;
}
 
开发者ID:zhonglikui,项目名称:cardinalsSample,代码行数:20,代码来源:PhotoCaptureUtil.java

示例2: openFilePicker

import android.app.Activity; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
public static void openFilePicker(Activity activity) {
    Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.setType("audio/*");
    i.putExtra("android.content.extra.SHOW_ADVANCED", true);
    activity.startActivityForResult(i, SAFUtil.REQUEST_SAF_PICK_FILE);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:9,代码来源:SAFUtil.java

示例3: importBookmarks

import android.app.Activity; //导入方法依赖的package包/类
/**
 * This method starts open document system activity.
 * @param activity
 */
@TargetApi(Build.VERSION_CODES.KITKAT)
public static void importBookmarks(Activity activity) {
    // choose a file via the system's file browser
    Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
    // show only results that can be "opened", such as a file
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    // filter to show only plain text
    intent.setType(MIME_TYPE);

    activity.startActivityForResult(intent, READ_REQUEST_CODE);
}
 
开发者ID:nfdz,项目名称:foco,代码行数:16,代码来源:ImportExportUtils.java

示例4: startImagePicker

import android.app.Activity; //导入方法依赖的package包/类
public static void startImagePicker(Activity activity, boolean showCamera,
                                    boolean clear, boolean crop,
                                    boolean multiMode, int selectLimit,
                                    @ImageDataSource.LoaderType int loadType,
                                    CropImageView.Style style /*图片剪切框的形状*/) {
    ImagePicker imagePicker = ImagePicker.getInstance();
    imagePicker.setImageLoader(new GlideImageLoader());
    imagePicker.setCrop(crop);
    imagePicker.setMultiMode(multiMode);
    imagePicker.setShowCamera(showCamera);
    imagePicker.setSelectLimit(selectLimit);
    imagePicker.setOutPutX(800);
    imagePicker.setOutPutY(800);
    imagePicker.setFocusWidth(600);
    imagePicker.setFocusHeight(600);
    imagePicker.setLoadType(loadType);
    imagePicker.setStyle(style);
    Intent intent = new Intent(activity, ImageGridActivity.class);
    intent.putExtra(ImageGridActivity.CLEAR_SELECTOR, clear);
    activity.startActivityForResult(intent, REQUEST_CODE);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:22,代码来源:ImagePickerHelper.java

示例5: cropPicture

import android.app.Activity; //导入方法依赖的package包/类
/***
 * 裁剪图片
 * @param activity Activity
 * @param uri 图片的Uri
 */
public static void cropPicture(Activity activity, Uri uri) {
	Intent innerIntent = new Intent("com.android.camera.action.CROP");
	innerIntent.setDataAndType(uri, "image/*");
	innerIntent.putExtra("crop", "true");// 才能出剪辑的小方框,不然没有剪辑功能,只能选取图片
	innerIntent.putExtra("aspectX", 1); // 放大缩小比例的X
	innerIntent.putExtra("aspectY", 1);// 放大缩小比例的X   这里的比例为:   1:1
	innerIntent.putExtra("outputX", 320);  //这个是限制输出图片大小
	innerIntent.putExtra("outputY", 320); 
	innerIntent.putExtra("return-data", true);
	// 切图大小不足输出,无黑框
	innerIntent.putExtra("scale", true);
	innerIntent.putExtra("scaleUpIfNeeded", true);
	File imageFile = new File(getImagePath(activity.getApplicationContext()));
	innerIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
	innerIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
	activity.startActivityForResult(innerIntent, REQUEST_CROP_IMAGE);
}
 
开发者ID:SoulEaterVTT,项目名称:KotlinStudy,代码行数:23,代码来源:FaceUtil.java

示例6: startActivityForResult

import android.app.Activity; //导入方法依赖的package包/类
/**
 * Safe Start activity for result with ActivityOptionsCompats
 *
 * @param a           current activity
 * @param i           intent to launch
 * @param requestCode requestCcde
 * @param options     ActivityOptionsCompat
 */
public static void startActivityForResult(Activity a,
                                          Intent i,
                                          int requestCode,
                                          ActivityOptionsCompat options) {
    if (a == null) {
        return;
    }
    if (options != null) {
        a.startActivityForResult(
                i,
                requestCode,
                options.toBundle()
        );
    } else {
        a.startActivityForResult(
                i,
                requestCode);
    }
}
 
开发者ID:yajnesh,项目名称:AndroidGeneralUtils,代码行数:28,代码来源:ActivityUtil.java

示例7: openSAF

import android.app.Activity; //导入方法依赖的package包/类
public static void openSAF(Activity context) {

        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
        context.startActivityForResult(intent, 42);
    }
 
开发者ID:htqqdd,项目名称:music_player,代码行数:6,代码来源:menu_util.java

示例8: startForResultActivity

import android.app.Activity; //导入方法依赖的package包/类
public static void startForResultActivity(Activity context, Class<?> forwardActivity, int requestCode, Bundle bundle, Boolean isFinish, int animin, int animout) {
    Intent intent = new Intent(context, forwardActivity);
    //intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    if (bundle != null)
        intent.putExtras(bundle);
    context.startActivityForResult(intent, requestCode);
    if (isFinish) {
        context.finish();
    }
    try {
        context.overridePendingTransition(animin, animout);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:zhou-you,项目名称:RxEasyHttp,代码行数:16,代码来源:AppTools.java

示例9: launch

import android.app.Activity; //导入方法依赖的package包/类
public static void launch(Activity context, String pname, String expire, String price, String pdescription, String orderId) {
    Intent intent = new Intent(context, PaySucceedActivity.class);
    intent.putExtra("pname", pname);
    intent.putExtra("expire", expire);
    intent.putExtra("price", price);
    intent.putExtra("payType", pdescription);
    intent.putExtra("orderId", orderId);
    context.startActivityForResult(intent, 17);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:10,代码来源:PaySucceedActivity.java

示例10: openPhotoCutter

import android.app.Activity; //导入方法依赖的package包/类
public static void openPhotoCutter(Activity activity, Uri uri) {
    Intent intent = new Intent("com.android.camera.action.CROP");
    intent.setDataAndType(uri, "image/*");
    intent.putExtra("crop", "true");
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra("outputX", 192);
    intent.putExtra("outputY", 192);
    intent.putExtra("return-data", true);
    intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
    activity.startActivityForResult(intent, Types.TYPE_SAVE_PROFILE);
}
 
开发者ID:SailFlorve,项目名称:RunHDU,代码行数:13,代码来源:ImageUtil.java

示例11: startActivity

import android.app.Activity; //导入方法依赖的package包/类
public static void startActivity(Activity context, String url) {
    if (!TextUtils.isEmpty(url)) {
        Intent i = new Intent(context, SportPlayActivity.class);
        i.putExtra("VIDEO_URL", url);
        PlayerManager.getInstance().prepareFullScreen();
        context.startActivityForResult(i, 1);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:SportPlayActivity.java

示例12: openSetting

import android.app.Activity; //导入方法依赖的package包/类
/**
 * 打开网络设置界面
 */
public static void openSetting(Activity activity, int requestCode) {
    Intent intent = new Intent("/");
    ComponentName cm = new ComponentName("com.android.settings",
            "com.android.settings.WirelessSettings");
    intent.setComponent(cm);
    intent.setAction(Intent.ACTION_VIEW);
    activity.startActivityForResult(intent, requestCode);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:NetUtils.java

示例13: startSingleSignOn

import android.app.Activity; //导入方法依赖的package包/类
private boolean startSingleSignOn(Activity activity, String applicationId, String[]
        permissions, int activityCode) {
    boolean didSucceed = true;
    Intent intent = new Intent();
    intent.setClassName(ssoPackageName, ssoActivityName);
    intent.putExtra(UMSsoHandler.APPKEY, applicationId);
    String redirectUrl = SocializeConfig.getSocializeConfig().getSinaCallbackUrl();
    if (!TextUtils.isEmpty(redirectUrl)) {
        REDIRECT_URL = redirectUrl;
    }
    intent.putExtra("redirectUri", REDIRECT_URL);
    if (permissions.length > 0) {
        intent.putExtra("scope", TextUtils.join(",", permissions));
    }
    if (!validateAppSignatureForIntent(activity, intent)) {
        return false;
    }
    try {
        activity.startActivityForResult(intent, activityCode);
    } catch (ActivityNotFoundException e) {
        didSucceed = false;
    }
    if (this.isAlive) {
        this.isAlive = isServiceAlive(activity);
        if (this.isAlive) {
            activity.getApplication().unbindService(this.mServiceConnection);
        }
    }
    return didSucceed;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:SinaSsoHandler.java

示例14: start

import android.app.Activity; //导入方法依赖的package包/类
/**
 * 便捷启动当前activity
 *
 * @param activity 启动当前activity的activity
 */
public static void start(Activity activity, List<ColumnBean> selectedList, List<ColumnBean> optionalList) {
    Intent intent = new Intent(activity, ColumnActivity.class);
    Bundle bundle = new Bundle();
    bundle.putSerializable("selectedList_key", (Serializable) selectedList);
    bundle.putSerializable("optionalList_key", (Serializable) optionalList);
    intent.putExtras(bundle);
    activity.startActivityForResult(intent, MainActivity.REQUEST_CODE_COLUMN);
    activity.overridePendingTransition(R.anim.column_show, R.anim.column_bottom);
}
 
开发者ID:6ag,项目名称:LiuAGeAndroid,代码行数:15,代码来源:ColumnActivity.java

示例15: startAssitActivity

import android.app.Activity; //导入方法依赖的package包/类
protected void startAssitActivity(Activity activity, IUiListener iUiListener) {
    AssistActivity.setApiObject(this);
    int i = sRequestCode;
    sRequestCode = i + 1;
    this.mActivityIntent.putExtra("key_request_code", i);
    this.mTaskList.add(new ApiTask(i, iUiListener));
    activity.startActivityForResult(getAssitIntent(activity), Constants.REQUEST_API);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:BaseApi.java


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