I have an AsynkTask method on my MainActivity that it\'s the following:
class chargeCars extends AsyncTask> {
Method 1: Don't use clone just use object to add:
protected void onPostExecute(ArrayList c)
{
super.onPostExecute();
for(Car cr: c)
{
totalCars.add(cr);
}
//Code for further execution
}
Method 2: Make a method which will be called by onPostExceute() after it has got ArrayList
protected void onPostExecute(ArrayList c)
{
super.onPostExecute();
setValues(c);
}
private void setValues(ArrayList c){
for(Car cr: c)
{
totalCars.add(cr);
}
//Code for further execution
}