I have two Activities: Activity A and Activity B:
‘A’ is my Main Activity, and it has a Button to Activity B. And ‘B’ has a Button to ‘A’. And now is my Question how I can find out that the User is coming from Activity B.
When I use “getIntent()” it is the Intent from the Main Activity, but I need the
Intent from the Activity B.
Thanks!
When you are passing the intent from Activity B you have to create a new itent and just add some extra data with it to to identify it. Like
I n t e n t i n t e n t = n ew I n t e n t ( t h i s , A c t i v i t yA . c l a s s ) ; i n t e n t . p u t E x t r a ( ” c a l l e r ” , ” A c t i v i t yB ” ) ;
s t a r t A c t i v i t y ( i n t e n t ) ;
And in Activity A fetch the extra data using getIntent().getExtras() methods.
like
S t r i n g c a l l e r = g e t I n t e n t ( ) . g e t S t r i n g E x t r a ( ” c a l l e r ” ) ;