本文整理汇总了Java中android.support.v4.app.Fragment.startActivity方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.startActivity方法的具体用法?Java Fragment.startActivity怎么用?Java Fragment.startActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.Fragment
的用法示例。
在下文中一共展示了Fragment.startActivity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendScheme
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void sendScheme(Fragment context, String url, Bundle bundle, boolean clearTop, int flag) {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
if(bundle != null) {
intent.putExtras(bundle);
}
if(clearTop) {
intent.addFlags(67108864);
}
if(flag != 0) {
intent.setFlags(flag);
}
context.startActivity(intent);
}
示例2: go
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
@Override
public void go(Fragment fragment) {
FragmentActivity activity = fragment.getActivity();
Context context = fragment.getContext();
Intent intent = getIntent(activity != null ? activity : context);
if (intent == null) {
return;
}
Bundle options = mRouteRequest.getActivityOptionsCompat() == null ?
null : mRouteRequest.getActivityOptionsCompat().toBundle();
if (mRouteRequest.getRequestCode() < 0) {
fragment.startActivity(intent, options);
} else {
fragment.startActivityForResult(intent, mRouteRequest.getRequestCode(), options);
}
if (activity != null && mRouteRequest.getEnterAnim() != 0 && mRouteRequest.getExitAnim() != 0) {
// Add transition animation.
activity.overridePendingTransition(
mRouteRequest.getEnterAnim(), mRouteRequest.getExitAnim());
}
callback(RouteResult.SUCCEED, null);
}
示例3: openWebPageAndShowSnackbarIfFail
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void openWebPageAndShowSnackbarIfFail(Fragment fragment, String url, View view) {
try {
fragment.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch (ActivityNotFoundException e) {
AndroidAppUtil.showLongSnackbar(view, R.string.internet_connection_failed);
}
}
示例4: navigation
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public void navigation(Fragment fragment) {
Class clazz = RouteManager.getInstance().getRoute(mPath);
if (clazz == null) {
return;
}
fragment.startActivity(getIntent(fragment.getActivity(), clazz));
}
示例5: startMe
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void startMe(Fragment fragment) {
Intent intent = new Intent(fragment.getActivity(), ListEntriesActivity.class);
fragment.startActivity(intent);
}