i have a problem in using intents
there are 5 activities in the application
the natural flow of passing intent extras is A–>B–>C–>D–>E
however depending on a condition , C may or may not be started
when C is not started, i want to start D from B directly
this time D will require data from A and B
if C is started it adds some intent extra and starts D
(D needs extras from A,B and C)
currently i have 2 make 2 copies of D to receive intents like this
is there a way wherein i can have a single copy Of D, which wil start depending on whether it is instantiated by either B or C
or D should obtain that extra intent which is put by C?
i m a complete noob to android,any workaround or solutions welcome please..
thanks !!
Put an extra flag , to decide which activity is calling D. check this flag when you start the activity D and if you get call from C look for extras passed form C, otherwise ignore them.
in activity B.
Intent i = newIntent(context, D.class);
i.putExtra(“fromC”, false);
startActivity(i);
in activity C:
in activity D:
HTH.