I have a Car object that has this constructor:
public Car(int idCar, String name) { this.idCar = idCar; this.name = name; }
I have no problems here, so I created one Car object named newCar , for example:
Car newCar = new Car(1,"StrongCar");
The problem is that I want to pass this newCar to my AsyncTask called modifyCar as a parameter, but I don't know how to do it.
I searched in SO and I found this question: AsyncTask passed custom objects but the problem is not resolved, because in the solution it is given, they pass String only to AsyncTask , and not completely to the object.
I want it to pass the entire object as a parameter to AsyncTask.
In accordance with the solution that was asked in the question I posed above, I tried to do this in order to pass the object to AsyncTask .
new modifyCar(newCar).execute();
So, I declared AsyncTask as follows:
class modifyCar extends AsyncTask<Car, Integer, ArrayList<Evento>> { protected void onPreExecute() { } protected ArrayList<Evento> doInBackground(Car... newCarAsync) {
But I do not know if it is right or not. If not, what should I do for this purpose?
Thanks in advance!