本文整理匯總了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);
}