Darius92
Darius92

Reputation: 311

Android: AsyncTask post different variable types

I have class where am using HttpURLConnection,which am using to post String variables to my server:

public class SendPostRequestLocation extends AsyncTask<String, Void, String> {}

Now if I need to send other type variables, for examples Int, or Doubles .Do I need to create another almost same class, or I need everything convert to String and use my only one class?Or if its possible to make my class more universal to work with different variables types?

Upvotes: 0

Views: 26

Answers (1)

marmor
marmor

Reputation: 28179

Since everything in HTTP ends up being a String, the easiest way would be to convert the variable to a String and use the same AsyncTask.

Upvotes: 2

Related Questions