Esta parte de codigo
public List<RutaArco> generatePreOptimalRoute() throws InterruptedException {
List<RutaArco> aux = new ArrayList<>();
Toast.makeText(this,"ForceBrute=not done yet",Toast.LENGTH_LONG).show();
for (int i= 0;i<Points.size();i++)
{
for (int j= 0; j < Points.size(); j++) {
if(i!=j) {
String starter = String.valueOf(Points.get(i).latitude) + "," + String.valueOf(Points.get(i).longitude);
String ender = String.valueOf(Points.get(j).latitude) + "," + String.valueOf(Points.get(j).longitude);
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + starter + "&destinations=" + ender + "&mode=driving&language=fr-FR&avoid=tolls&key=" + R.string.API_MATRIX_KEY;
GeoTask a = (GeoTask) new GeoTask(MapActivity.this).execute(url);
aux.add(new RutaArco(Points.get(i), Points.get(j), temporaloptimaldistance, temporaloptimaltime));
temporaloptimaltime = "";
temporaloptimaldistance = 0.0;
}
}
}
Toast.makeText(this,"ForceBrute=Done",Toast.LENGTH_LONG).show();
return aux;
}
Exactamente en la parte de la ejecucion del Geotask la cual esa es la tarea asyncrona,necesito que se ejecute y se termine de ejecutar para realizar la siguiente llamada a la linea de codigo, porque tnego que almacenar los resultados en una lista. Como puedo hacer para que se quede esperando hasta que se complete la tarea?