本文整理了Java中android.app.Activity.startActivityFromFragment()
方法的一些代码示例,展示了Activity.startActivityFromFragment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.startActivityFromFragment()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:startActivityFromFragment
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void canStartActivityFromFragment() {
final Activity activity = Robolectric.setupActivity(Activity.class);
Intent intent = new Intent(Intent.ACTION_VIEW);
activity.startActivityFromFragment(new Fragment(), intent, 4);
ShadowActivity.IntentForResult intentForResult = shadowOf(activity).getNextStartedActivityForResult();
assertThat(intentForResult.intent).isSameAs(intent);
assertThat(intentForResult.requestCode).isEqualTo(4);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void canStartActivityFromFragment_withBundle() {
final Activity activity = buildActivity(Activity.class).create().get();
Bundle options = new Bundle();
Intent intent = new Intent(Intent.ACTION_VIEW);
activity.startActivityFromFragment(new Fragment(), intent, 5, options);
ShadowActivity.IntentForResult intentForResult = shadowOf(activity).getNextStartedActivityForResult();
assertThat(intentForResult.intent).isSameAs(intent);
assertThat(intentForResult.options).isSameAs(options);
assertThat(intentForResult.requestCode).isEqualTo(5);
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param fragment
* @param intent
* @param requestCode
* @see android.app.Activity#startActivityFromFragment(android.app.Fragment,
* android.content.Intent, int)
*/
public void startActivityFromFragment(Fragment fragment,
Intent intent,
int requestCode) {
mActivity.startActivityFromFragment(fragment, intent, requestCode);
}
代码示例来源:origin: iqiyi/Neptune
@Override
public void startActivityFromFragment(android.app.Fragment fragment0, android.content.Intent intent1, int int2) {
mOriginActivity.startActivityFromFragment(fragment0, intent1, int2);
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param fragment
* @param intent
* @param requestCode
* @param options
* @see android.app.Activity#startActivityFromFragment(android.app.Fragment,
* android.content.Intent, int, android.os.Bundle)
*/
public void startActivityFromFragment(Fragment fragment,
Intent intent,
int requestCode,
Bundle options) {
mActivity.startActivityFromFragment(fragment, intent, requestCode, options);
}
代码示例来源:origin: iqiyi/Neptune
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startActivityFromFragment(android.app.Fragment fragment0, android.content.Intent intent1, int int2, android.os.Bundle bundle3) {
mOriginActivity.startActivityFromFragment(fragment0, intent1, int2, bundle3);
}
代码示例来源:origin: ManbangGroup/Phantom
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void startActivityFromFragment(@NonNull android.app.Fragment fragment, Intent intent,
int requestCode, @Nullable Bundle options) {
mContentProxy.getContext()
.startActivityFromFragment(fragment,
mContentProxy.setActivityIntentExtra(intent), requestCode, options);
}
代码示例来源:origin: ManbangGroup/Phantom
@Override
public void startActivityFromFragment(@NonNull android.app.Fragment fragment, Intent intent, int requestCode) {
mContentProxy.getContext().startActivityFromFragment(fragment,
mContentProxy.setActivityIntentExtra(intent), requestCode);
}
内容来源于网络,如有侵权,请联系作者删除!