AnsweredAssumed Answered

It's possible animate some images from radar or satellite over the map?

Question asked by Maursalazar75 on May 14, 2018

I try to animate, or make a loop with 10 images from radar or satellite, i use Async task in the begining  works but after some days, is showing a error with "Fatal signal 6 (SIGABRT)".

 

Some body know how to make animation with this images?

Here is my Async Task.

 

private class kmlLoop extends AsyncTask<String, String, String> {
//private Context context;
private ProgressBar loadingImg= null;

@Override
protected void onPreExecute(){
loadingImg = (ProgressBar) findViewById(R.id.loadImg);
loadingImg.setVisibility(View.VISIBLE);
}

int k=0;
KmlLayer[] kmlArray=new KmlLayer[13];

@Override
protected String doInBackground( String... file_url) {
System.out.println("KmlLoopOn::"+kmlLoopOn);
try {
for (int i = 0; i < 13; i++) {

String urlPath = getString(R.string.urlAnimacion) + i + ".kml";
System.out.println("Intentando descargar descargando KML "+urlPath);
URL url = new URL(urlPath);

InputStream input = url.openConnection().getInputStream();
FileOutputStream output = MainActivity.this.openFileOutput(i + ".kml", Context.MODE_PRIVATE);

int read = 0;
byte[] data = new byte[1024];
while ((read = input.read(data)) != -1)
output.write(data, 0, read);
output.close();

kmlArray[i] = new KmlLayer(context.getFilesDir().getAbsolutePath() + "/" + i + ".kml");
kmlArray[i].setOpacity(0.8f);
kmlArray[i].setVisible(false);
map.addLayer(kmlArray[i]);
}
} catch (Exception ExcDescKml) {
System.out.println("Error descargando KML" + ExcDescKml);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");

while (runLoop) {
System.out.println(k+"inicio error inicio while");
try {
System.out.println(k+"inicio error antes del sleep");
//Thread.sleep(1000);
System.out.println(k+"inicio error Despues del sleep");
if (map.isLoaded()) {

kmlArray[k].setVisible(false);
k++;
if (k > 12) {
k = 0;
}
kmlArray[k].setVisible(true);
}

Date now = Calendar.getInstance().getTime();
System.out.println(k+" Espero 1 seg esperando... KML"+ sdf.format(now.getTime()));
if (k == 12) {
System.out.println(k+"inicio error 1");
//Thread.sleep(2000);
if (loadingImg.getVisibility() == View.VISIBLE){
publishProgress("loading.Visibility");
}
System.out.println(k+"inicio error 2");
}
} catch (Exception Exc) {
runLoop = false;
System.out.println("Error esperando::" + Exc);
}
}
if (!runLoop){
try {
System.out.println("Eliminando LOOP");
for (int l = 0; l < 13; l++) {
System.out.println("Eliminando LOOP KML " + l);
map.removeLayer(kmlArray[l]);
}
kmlArray = null;
kmlLoopOn = false;
runLoop = false;
}catch (Exception ExcRemoveKml){
System.out.println("Error removiendo KML");
}
}

return null;
}

@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);
loadingImg.setVisibility(View.GONE);

}
//After completing background task
@Override
protected void onPostExecute(String file_url) {
System.out.println("Asyn Task complete, LOOP KML LAYER");
if (loadingImg.getVisibility() == View.VISIBLE){
publishProgress("loading.Visibility");
}

}
}

**********************************************

And this is the error:

2018-05-14 11:25:18.805 26846-26887/nav A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 26887 (GLThread 399), pid 26846 (a.nav)

Outcomes