當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。