I want to create an AsyncTask that will handle my communication with the server (the client is the android app and the server is python). My main activity will need, depends on user interaction, send data to the server. How can I pass the string that changes all the time to the AsyncTask? For example, I have this variable in my main activity:
String toSend = "Something"
The user pressed a button and now the string contains this data:
toSend = "After Button Pressed"
The question is how can I pass the always changing toSend
string to the Async Task?
UPDATE:
I know how to create an AsyncTask. The AsyncTask will be started at the beginning of the activity. It is not a private class in the activity. The input to the AsyncTask is dinamically changing (based in user interacts). Is there a way to have a dinamically changing input to the task? Maybe pass it by ref?