Java Code Examples for android.support.v4.app.ActivityCompat.startActivityForResult()

The following are Jave code examples for showing how to use startActivityForResult() of the android.support.v4.app.ActivityCompat class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: yjPlay   File: MainListActivity.java   Source Code and License Vote up 6 votes
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());
}
 
Example 2
Project: GitHub   File: Router.java   Source Code and License Vote up 5 votes
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);
        }
    }
}
 
Example 3
Project: Renrentou   File: Router.java   Source Code and License Vote up 5 votes
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);
        }
    }
}
 
Example 4
Project: smartkey   File: ActivityTarget.java   Source Code and License Vote up 5 votes
/**
 * 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);
    }
}
 
Example 5
Project: Router   File: RealRouter.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 6
Project: Logistics-guard   File: PermissionsActivity.java   Source Code and License Vote up 4 votes
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);
}
 
Example 7
Project: Review-   File: PermissionsActivity.java   Source Code and License Vote up 4 votes
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);
}
 
Example 8
Project: EvilsLive   File: PermissionsActivity.java   Source Code and License Vote up 4 votes
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);
}
 
Example 9
Project: Alligator   File: ActivityHelper.java   Source Code and License Vote up 4 votes
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);
}
 
Example 10
Project: DereHelper   File: Base.java   Source Code and License Vote up 4 votes
@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);
}