Of course you can do it. You need to analyze the intention in action and use the fragment manager to fill in the late fragment that you want. Replace the action and fragment with yours.
@Override protected void onNewIntent(final Intent intent) { super.onNewIntent(intent); parseIntent(intent); } private void parseIntent(Intent intent) { final String action = intent.getAction(); if (action != null) { if (Action.<ONE>.equals(action)) { FragmentManager fm = getFragmentManager(); Fragment<ONE> fragment = (Fragment<ONE>) Fragment.instantiate(this, Fragment<ONE>.class.getCanonicalName(), getIntent().getExtras()); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragment_id, fragment); ft.commit(); } else if (Action.<TWO>.equals(action)) { FragmentManager fm = getFragmentManager(); Fragment<TWO> fragment = (Fragment<TWO>) Fragment.instantiate(this, Fragment<TWO>.class.getCanonicalName(), getIntent().getExtras()); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragment_id, fragment); ft.commit(); } } }
Actions are simply lines that should be unique to a given intent. They can be anything. How:
"myapp.image_included" or "myapp.link_url" etc.
source share