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


Java ActivityCompat.startActivityForResult方法代码示例

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


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

示例1: start

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
private void start(View view, String uri) {
    //进入详细暂停视频
    long currPosition = 0;
    ManualPlayer manualPlayer = VideoPlayerManager.getInstance().getVideoPlayer();
    if (manualPlayer != null) {
        isReset = false;
        currPosition = manualPlayer.getCurrentPosition();
    }
    Log.d("currPosition", currPosition + "");
    Intent intent = new Intent(MainListActivity.this, MainListInfoCustomActivity.class);
    ActivityOptionsCompat activityOptions = makeSceneTransitionAnimation(
            this, new Pair<>(view.findViewById(R.id.exo_play_context_id),
                    MainCustomLayoutActivity.VIEW_NAME_HEADER_IMAGE));
    intent.putExtra("currPosition", currPosition);
    intent.putExtra("uri", uri);
    ActivityCompat.startActivityForResult(this, intent, 10, activityOptions.toBundle());
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:18,代码来源:MainListActivity.java

示例2: launch

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
public void launch() {
    try {
        if (intent != null && from != null && to != null) {

            if (callback != null) {
                callback.onBefore(from, to);
            }

            intent.setClass(from, to);

            intent.putExtras(getBundleData());

            if (options == null) {
                if (requestCode < 0) {
                    from.startActivity(intent);
                } else {
                    from.startActivityForResult(intent, requestCode);
                }

                if (enterAnim > 0 && exitAnim > 0) {
                    from.overridePendingTransition(enterAnim, exitAnim);
                }
            } else {
                if (requestCode < 0) {
                    ActivityCompat.startActivity(from, intent, options.toBundle());
                } else {
                    ActivityCompat.startActivityForResult(from, intent, requestCode, options.toBundle());
                }
            }

            if (callback != null) {
                callback.onNext(from, to);
            }
        }
    } catch (Throwable throwable) {
        if (callback != null) {
            callback.onError(from, to, throwable);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:Router.java

示例3: realGoForResult

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
/**
 * Go for result with transition animation.
 * @param src
 * @param intent
 */
protected void realGoForResult(Activity src, Intent intent, int reqCode) {
    if(transitionView != null && transitionName != null) {
        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation((Activity) src, transitionView, transitionName);
        ActivityCompat.startActivityForResult((Activity) src, intent, reqCode, options.toBundle());
    } else {
        src.startActivityForResult(intent, reqCode);
    }
}
 
开发者ID:foreveruseful,项目名称:smartkey,代码行数:15,代码来源:ActivityTarget.java

示例4: go

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
@Override
public void go(Context context) {
    Intent intent = getIntent(context);
    if (intent == null) {
        return;
    }

    Bundle options = mRouteRequest.getActivityOptionsCompat() == null ?
            null : mRouteRequest.getActivityOptionsCompat().toBundle();

    if (context instanceof Activity) {
        ActivityCompat.startActivityForResult((Activity) context, intent,
                mRouteRequest.getRequestCode(), options);

        if (mRouteRequest.getEnterAnim() != 0 && mRouteRequest.getExitAnim() != 0) {
            // Add transition animation.
            ((Activity) context).overridePendingTransition(
                    mRouteRequest.getEnterAnim(), mRouteRequest.getExitAnim());
        }
    } else {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        // The below api added in v4:25.1.0
        // ContextCompat.startActivity(context, intent, options);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            context.startActivity(intent, options);
        } else {
            context.startActivity(intent);
        }
    }

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

示例5: startActivityForResult

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
public static void startActivityForResult(Activity activity, int requestCode, String... permissions) {
    Intent intent = new Intent(activity, PermissionsActivity.class);
    intent.putExtra(EXTRA_PERMISSIONS, permissions);
    ActivityCompat.startActivityForResult(activity, intent, requestCode, null);
}
 
开发者ID:NaOHAndroid,项目名称:Logistics-guard,代码行数:6,代码来源:PermissionsActivity.java

示例6: startForResult

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
public void startForResult(Intent intent, int requestCode, TransitionAnimation animation) {
	Bundle optionsBundle = animation.getActivityOptionsBundle(mActivity);
	animation.applyBeforeActivityStarted(mActivity, intent);
	ActivityCompat.startActivityForResult(mActivity, intent, requestCode, optionsBundle);
	animation.applyAfterActivityStarted(mActivity);
}
 
开发者ID:aartikov,项目名称:Alligator,代码行数:7,代码来源:ActivityHelper.java

示例7: jumpForResultWithTran

import android.support.v4.app.ActivityCompat; //导入方法依赖的package包/类
@SafeVarargs
public final static void jumpForResultWithTran(int code, BaseActivity mContext, Class dst, View view, String name, Pair<String, String>... data) {
    Pair<Intent, Bundle> pair = prepareTran(mContext, dst, view, name, data);
    ActivityCompat.startActivityForResult(mContext, pair.first, code, pair.second);
}
 
开发者ID:Lazyeraser,项目名称:DereHelper,代码行数:6,代码来源:Base.java


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