Reputation: 6114
Consider three Activities, A,B,C . I want to pass data from Activity
A to Activity
C, however Activity
C is not launched from Activity
A , instead it is launched from Activity
B, So what I am looking for is a solution if I can send an Integer
value to Activity
C from Activity
A , and Activity
C receives that value whenever it gets executed, can I use intent.putExtra()
for this purpose? Any help will be appreciated.
Upvotes: 1
Views: 94
Reputation: 1959
if intent.putExtra()
does not work for you then you can try saving data in application level.
You can save data from A
to certain variable which is in Application level.
Or you can just use sharedPreferences
or sqlite
.
Upvotes: 0
Reputation: 1924
You can keep passing the bundle to activity B and get that data through intent and same thing you can pass that same bundle in activity B on click of a button or the selected view and get the same intent in Activity C, so finally your query has to be fulfill.
Upvotes: 0
Reputation: 654
I don't have the reputation to comment so giving it as answer. You answered in your question, intent.putExtra is the way to go. But pass the value from A to B and B to C, if you find it annoying make use of shared preferences and put value from activity A and when needed in activity C get the value and use it.
Upvotes: 0
Reputation: 27505
Yes You are right . you can use intent.putExtra()
intent.putExtra()
from activity A to activity B .Upvotes: 2