Send parameters of an Activity to a calculation class

0

I have a question about time, I posted it here once but it has not been solved. I would like to pass a parameter from an Activty to a calculation class (this class has no activity, it's just to calculate). I researched a lot about it and did not find it, because what I see is the passage between Activities.

I have some doubt in that because in the recovery of the parameters, we put the intents in public onCreat and when creating a new class does not have that. How would I do that?

Sorry to not post code to help or anything, I'm on my cell phone.

Thank you for everyone's attention!

I would like to do something like this. It's possible? If so, what is the right way to do it? [insert description of image here] ( link )

    
asked by anonymous 03.03.2017 / 19:14

1 answer

0

Creating the class:

public class MinhaClasse {
    Context context;
    ProgressDialog progressDialog;
    String nomedoarquivo;
    String servidorremoto;
    Handler handler;


    public MnhaClasse(Context context, 
                      String arquivo, 
                      String servidorremoto, 
                     Handler handler ) {
        this.context = context;
        this.nomedoarquivo = arquivo;
        this.servidorremoto = servidorremoto;
        this.handler = handler;
    }
    ....

In Activity you instantiate the class by passing the parameters and call the execute method of the same.

new MinhaClasse(getActivity(), arquivo, servidorremoto,myHandler).execute(arquivo);
    
03.03.2017 / 19:35