My program consists of a MainActivity and two fragment activities. I need one fragment to take a String value from the user and pass it to the second fragment.
I am trying to wrap my head around how to do this. Since I am familiar with intents, I found this answer on another post and decided to try it out. Everything looks fine until I get to step 4, when I try to use Intent i = getIntent();
in my second fragment, Studio won't let me use it and says "getIntent(java.lang.String) is deprecated"
.
This doesn't make sense to me since I have used getIntent()
in other programs without issue, and it is letting me use it in my MainActivity
(step 2 from the other post) without screaming at me.
I know this can be done without using intents, but I can't figure it out and can't find any really thorough tutorials in order to do so. So I guess my questions are:
- Can I make intents work for this purpose still? What should I do to get around this deprecation issue?
- Any other advice, explanations, or links to "explain it like I'm 5" tutorials would be very helpful and welcome. I have Googled and read a few, but I am still not understanding this and am becoming increasingly frustrated. It seems like this should be a relatively simple concept.