本文整理汇总了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());
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}