My example:
public static final String EXTRA_TARGET_FRAGMENT = "fragment_to_show";
public static void show(Activity pActivity,
Class<? extends Fragment> fragment) {
Intent intent = new Intent(pActivity, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(EXTRA_TARGET_FRAGMENT, fragment);
pActivity.startActivity(intent);
}
@SuppressWarnings("unchecked")
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
mUpcomingTarget = (Class<Fragment>) intent
.getSerializableExtra(EXTRA_TARGET_FRAGMENT);
}
mUpcomingTarget --> null, I cannot understand what the problem is.