0
I’ve had a question for a while, I posted it here once, but it hasn’t been solved. I would like to pass a parameter from an Activty to a calculus class (this class does not have Activity , it is only to calculate). I researched a lot about it and did not find, because what I see is passage between Ctivitys.
I have some doubt in this because in the recovery of the parameters, we put the intents inside public onCreat and when creating a new class does not have this. How would I do that?
Sorry I didn’t post code to help or anything, I’m by phone.
Thank you all for your attention.!
I would like to do something like that. Is it possible? If it is, what is the right way to do it? [insert image description here] (https://i.stack.Imgur.com/Ai64u.png)
It would not be useful to instantiate the class for example: Classe_calculo example = new Classe_calculo(); example.calculate();` this does not work?
– ZelDias
put the Activity and calculus class code ; )
– Lucas
Hi guys. I’m by cell phone, so I have no way to post. Basically how to receive information from an Activity in a class. How I will recover there with the Intent if you do not have onCreat to the Voce create a new class.
– Ana Waldila
Look, I only see 2 ways to do this: Either you register this Activity object somewhere so that your data is accessible in a Singleton class, for example, or you create a generic controller and arrow the Activity data in it. If the target parameters you want change frequently, it is best to keep the Activity object reference even.
– Giuliana Bezerra
I put a picture of what I’d like to do!!
– Ana Waldila